I have two text field as mandatory and rest of the of the fields are normal. Now i have to detect enter key and submit the form. I have done that but the issue is that when error occurs (for example : fields are null) then i have to stop submitting the form but still form is submitting.
<input autocomplete="off" type="text" id="first_name" size="10"
onkeypress="if(event.keyCode == 13){
document.getElementById('btn_search').click();
return false;}">
Here btn_search is the id of the search button and I have to execute it. but when field is null then form should not be submitted. Give me some suggestion ??
Even i make separate function in JavaScript file, I am getting same response. Actually I am facing this problem from last 48 hours.