Validate: prepopulated fields

Validate: prepopulated fields

Using jQuery validate plugin v1.14.0 for client-side validation.

Sometimes fields can come pre-populated from the server, eg:

<input type="email" name="email" id="email" required="required" value=" aa@b.c" />

If I focus into this field and delete the email address I would expect to get a " This field is required " error message, but I don't. In fact not even the following sequence shows an error:

- focus in
- empty field
- focus out
- focus in
- repopulate field with new (valid) value
- focus out
- focus in
- empty field

The only way to get a required error message is to populate the field with an invalid value.

If value is empty or not present error messages appear as expected.

Similarly, behaviour is a bit weird if field comes pre-populated from the server with an invalid value (kind of a fringe use case, but it could happen). Here validation is triggered on blur even if the user doesn't change the field value. As a user I would expect initial validation to occur if I change something or submit, not by simply tabbing through the form. If value is empty or not present error messages appear as expected: tabbing through an empty required field does not show an error.