[thelist] Different forms to the same script
Eric Engelmann
eric at geonetric.com
Mon, 29 Nov 1999 17:37:08 -0600
If you're talking about within JS, then there's no reason you can't. You can
refer to the different forms using the forms[] array
(document.forms[0]...[x]) and just process the data that way, so if you've
got one function, say an email validation routine, you can send that data to
it from multiple forms, no problem...
<script language="javascript">
function checkemail(formid) {
// formid contains the formid in the forms[] array
if (document.formid.emailaddress.value="")
{ return false; }
else
{ return true; }
}
</script>
<form name="form1" onsubmit="return checkemail(this);">
<input type="text"name="emailaddress">
...
</form>
<form name="form2" onsubmit="return checkemail(this);">
<input type="text"name="emailaddress">
...
</form>
Does that help? What exactly do you have in mind?
- Eric
> > Can I send values from different forms to the same Script? When I say
> > "different forms," I mean "separate but identical." I'm resorting to
> > virtually anything to get this page working.