B
Bryan
I have this function below
function checkLength(field, nextField)
{
var letters = document.form1.elements[field].value.length +1;
if (letters <= 2)
{document.form1.elements[field].focus()}
else
{document.form1.elements[nextField].focus()}
}
And i call it from here:
<form name="form1" method="POST" action="addComputer.php"
ONSUBMIT="return ValidateForm(this)">
Hardware Ethernet
<input type="text" name="hardwareEtherneta" maxlength=2 size=1
ONKEYUP="checkLength('1','2')">
</form>
My problem is that I have another form on a different page:
<form name="form2" method="POST" action="addComputer.php"
ONSUBMIT="return ValidateForm(this)">
Hardware Ethernet
<input type="text" name="hardwareEtherneta" maxlength=2 size=1
ONKEYUP="checkLength('1','2')">
</form>
When the call to check length from form2, it fails as document.form1
isn't an object. How do I need to alter the function keeping the 2
form names different to get the function to work ok?
Help greatly appreciated, sorry newbie!!!!
function checkLength(field, nextField)
{
var letters = document.form1.elements[field].value.length +1;
if (letters <= 2)
{document.form1.elements[field].focus()}
else
{document.form1.elements[nextField].focus()}
}
And i call it from here:
<form name="form1" method="POST" action="addComputer.php"
ONSUBMIT="return ValidateForm(this)">
Hardware Ethernet
<input type="text" name="hardwareEtherneta" maxlength=2 size=1
ONKEYUP="checkLength('1','2')">
</form>
My problem is that I have another form on a different page:
<form name="form2" method="POST" action="addComputer.php"
ONSUBMIT="return ValidateForm(this)">
Hardware Ethernet
<input type="text" name="hardwareEtherneta" maxlength=2 size=1
ONKEYUP="checkLength('1','2')">
</form>
When the call to check length from form2, it fails as document.form1
isn't an object. How do I need to alter the function keeping the 2
form names different to get the function to work ok?
Help greatly appreciated, sorry newbie!!!!