View Full Version : Help needed with If and else

05-10-2004, 04:24 AM
Hello everyone,

any help will be greatly appreciated.

I have an email form. On the " if " function, it verifies the form. that's ok. but on the " else " function, I would like the form to continue to submit but also go to a page called " thankyou.html ". Between the code listed below:

return true;

is there a way to insert between these lines to redirect to a new URL - inside this same window - after the form has been submitted. If so, what is this code? Perhaps I can insert the code also inside the " action " in the form? I really need some help, and would appreciate anyone's input.

Thank you kindly.

05-10-2004, 04:39 AM
i would recommend creating a hidden field. set the field to true or false. on the action, test for trueness. then redirect from the action script.

05-10-2004, 04:49 AM

thank you for your reply. I really don't know javascript, so would it be possible to let me know exactly what this hidden field would be written like with this true or false and where exactly I would place it in the code? I would really appreciate it.

Thank you very much in advance.

05-10-2004, 06:42 PM
So you want to submit to thankyou.html or do you want to submit to some other page, but end up on thankyou.html? In other words, what action have you set in your form?

Also when you're talking about this if and else, I'm not sure I follow:
If - validates the form and submits it if it validates, or alerts the user that the form did not validate.
Else - Doesn't validate the form, just submits it.

In both cases it sends the user to a thankyou.html page?

Please try to be as unambiguous as possible as it's hard to give a solution when you're half guessing.. so let us know.


Willy Duitt
05-10-2004, 08:20 PM
add location.replace or location.href to the bottom of your vaidation function and call onsubmit