javascript - Automatically Submit Form If there is Value -
i have problem store visitor session. have idea fix automatically submit form input if there value.
if use auto submit javascript, automatically submit regardless of whether or not existing value in input section.
html code
<form id="id_form" action="login.php" method="post"> username: <input type="text" name="user" id="user" value="this_value" /><br /> password: <input type="password" name="password" id="password" value="this_password" /><br /> save password: <input type="checkbox" name="session"/><br /> <input type="submit" value="submit" /> </form>
javascript
<script> setinterval(function() {submitform();}) { document.getelementbyid("id_form").submit(); } </script>
visitors save password checking section, submit automatically if time visit page again. how can work, there solution?
use following javascript code:
if (document.getelementbyid("user").value !== "" && document.getelementbyid("password").value !== "") { document.getelementbyid("id_form").submit(); }
place @ end of html document make sure html has loaded.
Comments
Post a Comment