Project

General

Profile

Actions

Bug #7091

closed

jQuery Validate: required field validation unreliable

Added by krileon over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Target version:
Start date:
19 March 2018
Due date:
% Done:

100%

Estimated time:

Description

This is due to a bug in jQuery Validate it self as reported below.

https://github.com/jquery-validation/jquery-validation/issues/1975

The validation only kicks in after another validation rule has been applied then all required validation works as normally.

https://www.joomlapolis.com/forum/153-professional-member-support/238795-required-field-alert-on-moving-out-of-field#303125

Actions #1

Updated by krileon over 6 years ago

Either wait for new release of jQuery Validate to fix or try to implement a potential workaround. Likely some sort of add caching behavior for validation rules.

Actions #2

Updated by krileon over 6 years ago

Cause appears to be ! this.optional( element ) usages through jQuery Validate. The optional function will either return false, true, or dependency-mismatch so using the above condition doesn't work due to this as dependency-mismatch would cause that condition to fail.

Actions #3

Updated by krileon over 6 years ago

It's due to the wrong order of validation rules, but that's due to $( element ).rules() not being called until after another validation rule has triggered which fixes the order so required rules are first and remote rules are last. Maybe the order can be fixed externally instead of relying on that function?

Actions #4

Updated by krileon over 6 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Fixed in MR !1325 with workaround of checking that ( this.optional( element ) !== true ) to treat false and dependency-mismatch as validation needs to be triggered.

Actions #5

Updated by krileon over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF