I am modifying existing javascript code where the author appears to be
passing an entire form to a javascript function called Require(). I
want to add a new test: "is @BHFOR.value = blanks". Interestingly it
works in Firefox but not IE so I suspect that the syntax is not
correct.
Is there a better way to test a specific element of the form in this
case?
Here is an extract of the code:
<script language="javascript" type="text/javascript">
function Require(obj) {
for (var i=0; i<obj.length; i++) {
// a bunch of numeric validations that work now.
}
// my addition that causes script to fail
if (obj.@BHFOR.value == " " )
{
alert("You must enter current License Number");
return false;
}
</script>
<form name="form1" action="OP1704.pgm"
onSubmit="return Require(this)">
<p>Enter Current License Number.</p>
<INPUT type="text" name="@BHFOR" size="25" maxlength="25" value="" >
</p>
<INPUT type="submit" name="submit" value=" Submit " class="btn">
</div>
</form>