Skip to content

highlight/errorPlacement fired in undefined/inconsistent conditions #139

Closed
@nzamani

Description

@nzamani

Please see http://jquery.bassistance.de/validate/demo/ to follow the steps explained here. We will fill some fields of the second form on that site to reproduce the issue.

  1. click with mouse into the field 'Firstname'.
  2. From now on we will not use the mouse any more!
  3. enter any value you want for the field 'Firstname' (i.e. 'abcd').
  4. hit the tab key on your keyboard to select the next field 'Lastname'
  5. enter any value you want for the field 'Lastname' (i.e. 'abcd').
  6. hit the tab key on your keyboard to select the next field 'Username' (don't change the suggested value)
  7. hit the keys shift+tab to go back to the previous field ('Lastname')
  8. now clear the field 'Lastname'

Expected Behaviour: Error Message for 'Lastname' is displayed since this is a required field, which is empty now.
Current Behaviour: No Error Message is Displayed.

I can reproduce this issue with my own examples. During debugging I could see that highlight/errorPlacement are not called (in my own example I passed these 2 options as well as unhighlight). This behaviour seems to be present especially for 'required' fields, i.e. for 'email' fields the expected Error Message is displayed ('Please enter a valid email address').

Furthermore I could see that after a call of $(#myForm).valid(), i.e. hit the submit buttom of the form above before starting the steps above, everything works as expected. Also, if you use at some points your mouse, sometimes it works all as espected.

I hope you can see that there is some kind of inconsistency. The behaviour seems to be pretty much unpredictable.

It seemt to me that in case a field has only a 'required' class the error message behaviour is not as expected. But in case the field has 'required' + some other class, i.e. 'email' or 'minlength', then everything works as expected for this field.

What could be the issue here?

see also http://forum.jquery.com/topic/validate-bug-highlight-errorplacement-fired-in-undefined-inconsistent-conditions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions