I always hated javascript, but now i need it to validate forms.
Also I'm not quite an expert in expressing my self. So this will be long to desfirbe what i have, and what i need to accomplish.
I have forms generated by php.
As html source the page shows something like:
<form name='1'>
<input type ='text' onkeyup = "validate(1)" name='mynumber' />
</form>
<form name='1'>
<input type ='text' onkeyup = "validate(2)" name='mynumber' />
</form>
and i also have a javascript function:
<script type='text/javascript'>
function validate(formnumber) {
if (document.formnumber.mynumber.value = 1) {
alert(whatever text);
}
}
</script>
well does not look exactly like this, but for the sake of problem description it should do it.
i need the same javascript to validate BOTH forms.
The javascript accepts 1 argument, that is always equal to the name of the form.
But then, why on earth does not it work?
I'm not 100% sure i managed to describe the problem properly.
But if I did, someone please tell what em i doing wrong, or hows this supposed to be done?