Skip to main content
Known Participant
October 13, 2006
Question

form onblur event

  • October 13, 2006
  • 1 reply
  • 510 views
I am placing all my edits for a form on each form field onBlur() event. I usually use the onSubmit event, but I can't use the onSubmit event in this situation.

I only have a problem when there are 2 form fields with onBlur events in sequence.
When you leave the focus for the first entry - social -the alert box for the next entry co-social displays also. You then have to go to the task manager to delete the session. The following is the code for 2 form fields with onBlur events in sequence:

<td colspan="2"><font face="Arial, Helvetica, sans-serif" size="3">
<input type="TEXT" value="" size="20" maxlength="11" name="social" onKeypress="if (event.keyCode < 48 && event.keyCode != 45 || event.keyCode > 57 ) event.returnValue = false;" onBlur = "if (!document.loanapp2.social.value){alert('Borrower Social security number is a required entry!');document.loanapp2.social.focus();return false;};">
</font></td>
<td width="37%"><font face="Arial, Helvetica, sans-serif" size="3">
<input type="TEXT" value="" size="20" maxlength="11" name="co_social" onKeypress="if (event.keyCode < 48 && event.keyCode != 45 || event.keyCode > 57 ) event.returnValue = false;" onBlur="if(document.loanapp2.co_lastname.value != '' && document.loanapp2.co_social.value == ''){alert('Co-borrower Social Security Number must be entered if Co-borrower name is entered!');document.loanapp2.co_social.focus();return false;};" >
</font></td>
This topic has been closed for replies.

1 reply

Inspiring
October 13, 2006
Use onChange instead of onBlur.
tappingAuthor
Known Participant
October 13, 2006
The onChange event will not work because these entries need to be required.


Thanks for your input.