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

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -