icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Reseller Hosting » form validation using onClick

Reseller Hosting Questions about your reseller hosting account.

Closed Thread
 
LinkBack Thread Tools Search this Thread
Old July 6th, 2003, 7:00 PM   #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?
__________________
"if that cant take a joke, f*** em" - tucker max

why things suck
shun is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old July 6th, 2003, 7:35 PM   #2 (permalink)
Surpass Fan
Excelling Contributor
 
EliteGeeks.com's Avatar
 
Joined in May 2003
Lives in Las Vegas, Nevada
Hosted on Dime9
632 posts
Gave thanks: 0
Thanked 0 times
http://developer.netscape.com/docs/example...l/overview.html
__________________
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.
EliteGeeks.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old July 11th, 2003, 8:30 PM   #3 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
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
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On