I have been searching for hours trying to find a way to validate my form while the user is typing. for example, I want have a field for zip code. I want the user to see a message underneath the field that says they have gone beyond the limit of characters for this field but before they submit the form. How can this be done?
with such code:
<form method="POST" name="wrriregistration" target="_blank"><center>
<table width="100%">
<tbody>
<tr>
<td width="149"><strong>*First Name:</strong></td>
<td width="229"><input type="text" name="first_name" size="35" maxlength="100"/></td>
<td width="123"><strong style="display:none;">Middle Initial:</strong></td>
<td width="659"><input style="display:none;" type="text" name="middle_initial" size="35" maxlength="50" /></td>
</tr>
</tbody>
</table>
</form>
maxlengthattribute will take care of users trying to enter too many characters. If it's validation that can be done just based on what's present on the form, you can just use simple Javascript to check the field using either theykeyup,keypressorchangeevents. If you need to validate against something on the back-end, you'll need to use AJAX.