I am trying to run the following code:
onsubmit="return
ValidateForm(document.AddRepayment.txtDate1,'lblDate1Req');return
ValidateForm(document.AddRepayment.txtDate2,'lblDate2Req');return
ValidateForm(document.AddRepayment.txtDate3,'lblDate3Req');"
I have tried a few ways, one was to include it in the code behind of my
ASP.NET page and use the button.attributes.add method and I also tried it
with the onclick event in the HTML portion of the page and it kept giving me
errors so now I am trying the onsubmit event which allows the code to run but
still does the 1st validation and bypasses the rest. All the ways that allow
it to run will only use the 1st ValidateForm call no matter what happens.
Once the first one is valid then it goes to the code behind like I didnt
include 2 others. Please let me know what I may be doing wrong.
Thanks,
Cleako
Martin Honnen - 22 Nov 2005 15:54 GMT
> I am trying to run the following code:
>
> onsubmit="return
> ValidateForm(document.AddRepayment.txtDate1,'lblDate1Req');return
> ValidateForm(document.AddRepayment.txtDate2,'lblDate2Req');return
> ValidateForm(document.AddRepayment.txtDate3,'lblDate3Req');"
You should return true from the onsubmit handler if you want to submit
the form and false otherwise so you want to use
onsubmit="
return ValidateForm(document.AddRepayment.txtDate1,'lblDate1Req') &&
ValidateForm(document.AddRepayment.txtDate2,'lblDate2Req') &&
ValidateForm(document.AddRepayment.txtDate3,'lblDate3Req');"

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/