| Reseller Hosting Questions about your reseller hosting account. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in May 2003
60 posts
Gave thanks: 0
Thanked 0 times
|
im trying to write a script that will check all fields of a form to make sure theya re filled out. when the user clicks the submit button, if they are not all filled out an alert pops us informing them to fill out all fields. i have the alert working and the validation is correct but, the form submits whether the alert pops up or not. how do i get the form to not submit if the alert pops up?
|
|
|
|
|
#2 (permalink) |
|
Surpass Fan
Excelling Contributor
Joined in May 2003
Lives in Las Vegas, Nevada
Hosted on Dime9
632 posts
Gave thanks: 0
Thanked 0 times
|
__________________
Disclamer: This is not a legal document. As with all information transfered via the internet, this message was subject to possible contamination and tampering I hold myself harmless as to its content as at appears at its intended destination. |
|
|
|
|
#3 (permalink) |
|
the one who was
Super #1
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
|
If there is no particular reason for using the onClick event, I would recommend removing it and adding an onSubmit event to the <FORM> tag itself, with the following format:
<form action="blah.htm" method="get" onSubmit="return yourValidateFunction();"> then the yourValidateFunction() would check the form, and if anything wasnt right, it should return false, otherwise it would return true. Just make sure that you put the return before the function name in the onSubmit. Anytime a return false is encountered there, the form will not submit. Patrick
__________________
Patrick Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org |
|
|