I have 2 forms I'd like to validate. For some reason I can only validate one form. Note: In my webpages I use php to include my header file (where the JS validation script is). My question is, what is the proper format to validate multiple forms with the following format?
<script type="text/javascript">
window.onload=function() {
document.Form1.onsubmit=function() {
...
field validating
...
}
}
I've tried this, but only one will work at a time (in this case Form1, since it's first):
<script type="text/javascript">
window.onload=function() {
document.Form1.onsubmit=function() {
...
field validating
...
}
document.Form2.onsubmit=function() {
...
field validating
...
}
}
Thanks!
Edit: This is for an assignment, so it doesn't need to be perfect at all :p
Edit 2: HTML Forms:
Table1.php
...
<form name="Form1" id="Form1" method="post" onSubmit="return(validate())">
...
Table2.php
...
<form name="Form2" id="Form2" method="post" onSubmit="return(validate())">
...
Obviously it's the onSubmit part that is causing the problem?