wommbatt Posted December 18, 2009 Share Posted December 18, 2009 i just got my form working the way i want, but for w/e reason after i hit submit it wont send, it merely does my form validation and then stops and reselects the password field <head><script type="text/javascript">function validate_required(field,alerttxt){ with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } }}function validate_form(thisform){with (thisform) { if (validate_required(email,"Please enter your email.")==false) { email.focus(); } else (validate_required(password,"Please enter a password.")==false) { password.focus(); } return false; }}</script></head> in the form action itself ive got the action linked to a cgi file where it should b routed to an email address, but as far as i can tell, its not sendingany suggestions? Link to comment Share on other sites More sharing options...
jeffman Posted December 19, 2009 Share Posted December 19, 2009 Your validate_form function has two problems I think.1. The last line of your with {} block causes it to return false, every time, no matter what. This halts the submission, and that's the big problem.2. else (validate_required . . . I think this was supposed to be else if Link to comment Share on other sites More sharing options...
wommbatt Posted December 19, 2009 Author Share Posted December 19, 2009 Your validate_form function has two problems I think.1. The last line of your with {} block causes it to return false, every time, no matter what. This halts the submission, and that's the big problem.2. else (validate_required . . . I think this was supposed to be else if ok, din no that, ill give it a shot ty 8] Link to comment Share on other sites More sharing options...
wommbatt Posted December 22, 2009 Author Share Posted December 22, 2009 ok, i changed it to else if and it works out pretty well, now ive got another issuewhen the last line sez return false, the script will stop after one of the first 2 if's conditions r met, which is what i wanthowever, if neither condition is met, it still wont send the form on to the cgi file that its linked toif the line instead is return true, it will send it on to the cgi, but it will do this even if one of the if conditions r metideas?i wish i understood this better Link to comment Share on other sites More sharing options...
jeffman Posted December 22, 2009 Share Posted December 22, 2009 Changing the statement causes the block to return true, every time, no matter what. True or false is not the answer, because the statement is not in the correct place. You might actually need two statements that return false. Link to comment Share on other sites More sharing options...
wommbatt Posted December 22, 2009 Author Share Posted December 22, 2009 ok so like, add a return false to the first 2 condition blocks? and a return true if the first 2 r indeed false as a third block? Link to comment Share on other sites More sharing options...
jeffman Posted December 23, 2009 Share Posted December 23, 2009 Try it. The worst that can happen is it doesn't work. If it does happen, you can move on to the next thing. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.