Skip to content

Appearance of non-deterministic validation on empty required fields #146

Closed
@syndicatedshannon

Description

@syndicatedshannon

**** ISSUE ****
The implementation 'lastElement' causes unpredictable results when validating empty fields. The interaction of cleared prior error messages further complicates. Finally, a successfully validated field (successList) does not receive the same frequency of validation as a previously invalidated field.

**** STEPS TO REPRODUCE ****
Use as an example the 'Remember The Milk' Form:
http://jquery.bassistance.de/validate/demo/milk/

  1. Tab or click into 'First Name' field. Enter text.
  2. Tab once or click into 'Last Name' field. Enter text.
  3. Shift-tab once or click into 'First Name' field. Clear text.
  4. Tab once or click into 'Last Name' field. Clear text.

**** EXPECTED RESULT ****
First Name and Last Name fields show invalid state.

**** ACTUAL RESULT ****
First Name shows valid state. Last Name shows invalid state.

**** OTHER USE CASES ****
I first really noticed this issue when validating a pre-filled (and then reloaded, as in a later edit of a profile) form. Fields that begin their life filled, even though they have passed the 'success' test and then been formatted accordingly, can have contents deleted and still visually appear valid.

**** COMMENTS ****
Looking at the code, I'm not certain what the intent was with 'lastElement', so I'm probably not the right party to make related adjustments. It appears to have been added to address a very specific issue. I also don't understand the intended difference between submitted[] and errorMap[], and some related topics.

I might recommend merely replacing the 'lastElement' check with a 'successList' membership check on keyup and focusout. If you want me to make that change, just shoot me an e-mail.

Shannon

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy