javascript - validate popup, then open another popup -


i using bootstrap create popup signup form. once user clicks submit , has been validated want close popup , open saying thank you. have tried using .modal('show') in popupvalidation.js did not seem work. did open both @ same time.

here code:

index.php

<form name="popup" action="<?php echo htmlspecialchars($_server["php_self"]);?>" onsubmit="return popupvalidation();" method="post">                   <div class="row">                     <input name="firstname" type="text" class="form-control" id="inputfirstname" placeholder="first name">                     <input name="lastname" type="text" class="form-control" id="inputlastname" placeholder="last name">                   </div>                   <div class="row">                     <input name="email" type="email" class="form-control" id="inputemail" placeholder="youremail@email.com">                   </div>                   <div class="row">                     <input name="password" type="password" class="form-control" id="inputpassword" placeholder="password">                   </div>                   <div class="row">                     <input name="repeatpass" type="password" class="form-control" id="retypepassword" placeholder="retype password">                   </div>                   <div class="row">                     <input name="trainer" type="checkbox"/> sign trainer                   </div>                   <div class="modal-footer popup-footer">                     <p id="error">please make sure fields filled out</p>                     <input type="submit" class="btn btn-default submit" value="register">                   </div>                 </form> 

popupvalidation.js

function popupvalidation() {     var fname = document.forms["popup"]["firstname"].value;     var lname = document.forms["popup"]["lastname"].value;     var pass = document.forms["popup"]["password"].value;     var repass = document.forms["popup"]["repeatpass"].value;     var email = document.forms["popup"]["email"].value;      if (fname==null || fname=="") {       document.getelementbyid("inputfirstname").focus();       document.getelementbyid("error").innerhtml= 'please enter first name';       document.getelementbyid("error").style.display = 'block';       return false;     }     if (lname==null || lname=="") {       document.getelementbyid("inputlastname").focus();       document.getelementbyid("error").innerhtml= 'please enter last name';       document.getelementbyid("error").style.display = 'block';       return false;     }     if (email==null || email=="") {       document.getelementbyid("inputemail").focus();       document.getelementbyid("error").innerhtml= 'please enter valid email';       document.getelementbyid("error").style.display = 'block';       return false;     }     if (pass==null || pass=="") {       document.getelementbyid("inputpassword").focus();       document.getelementbyid("error").innerhtml= 'please enter password';       document.getelementbyid("error").style.display = 'block';       return false;     }     if (repass==null || repass=="") {       document.getelementbyid("retypepassword").focus();       document.getelementbyid("error").innerhtml= 'please retype password';       document.getelementbyid("error").style.display = 'block';       return false;     }     if (repass!=pass) {       document.getelementbyid("retypepassword").focus();       document.getelementbyid("error").innerhtml= 'passwords not match';       document.getelementbyid("error").style.display = 'block';       return false;     }   } 


Comments