ericnet
Programmer
- Mar 29, 2006
- 106
I have a text field validation that is triggered with an ‘onBlur’ event, then the validation refocus in case the value in the text field isn’ t correct and is returned ‘false’ so that the user can’ t submit the form. If the value is correct then the validation returns true so that the user can submit the form normally.
This mechanism woks fine in IE, but not in Netscape7.2 which despite the value isn’ t correct in the text field the user can submit the form.
How can I solve this problem?
This is the code sample:
Other ideas and/or alternatives also will be welcomed,
Thank you
This mechanism woks fine in IE, but not in Netscape7.2 which despite the value isn’ t correct in the text field the user can submit the form.
How can I solve this problem?
This is the code sample:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--//
function check_field25() {
var cal_min = document.my_form.caliber_min.value
if (cal_min == "0") {
alert("You must enter a value greater than 0.")
setTimeout(function() {document.my_form.caliber_min.focus();},20);
return false;
}
return true;
}
// -->
</script>
</head>
<body>
<form name="my_form">
<input name="caliber_min" type="text" maxlength="8" id="caliber_min" [b]onBlur="check_field25();"[/b] width="50"><br>
<input type="text" width="100"><br><br>
<input type="submit" value="Submit the form">
</form>
</body>
</html>
Other ideas and/or alternatives also will be welcomed,
Thank you