Hi, We have a couple of textboxes in a form. All of which are validated onblur. The form is submitted onclick of an anchor tag.
<script>
function validateMyText(){
// do field validation
// if success
return true;
// else {
alert("Please check the text box value");
return false;
}
}
</script>
<form name="myform" action="mytestpage.jsp">
<input type="text" name="myText" id="myText" onblur="return validateMyText()"/>
<a href="#" onclick="mytestpage.jsp">Submit</a>
</form>
Windows platform browsers(Firefox, Safari, Chrome, IE): When validateMyText() returns false, onclick is not triggered. This is the expected and existing behaviour.
Mac platform browsers (Firefox, Safari): Even after validateMyText() returns false, onclick event is triggered, which submits the form.
Background: This is a legacy application that was supported only on Windows platform and IE browser. Now it has to be enhanced to work on all the browsers(Firefox, Safari, Chrome, IE) on Windows and Firefox, Safari on Mac.
Thanks, Mathew