Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate data then submit

Status
Not open for further replies.

tmcain

Programmer
Jan 29, 2002
25
0
0
US
I have looked through archives but haven't found my exact answer.
I have a button that when the onclick event is fired it runs a subroutine to validate data. Once that is finished I have code in the routine document.shipForm.submit

Interdev is aware of my controls because when i type the '.' the option i want comes up. However, I am getting the error that object does not exist.

Can someone give me a clue?
 
Instead of submitting the form at the end of the validate function, why don't you do something like this:
<input type=&quot;submit&quot; name=&quot;button1&quot; value=&quot;Submit&quot; onClick=&quot;JavaScript:return validation();&quot;>

Then, make your validation function look similar to this:
function validation(){
if document.form1.textbox1.value!=''{ //one validation
return false;
}
return true;
}


 
Sounds good, but I have a question.
I am not familiar with javascript. What will happen if the function returns false?
 
same thing in every other language. Nothing will happen. User redues what they did wrong. provide tools to let people become their best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top