Abhoryo / APYJsFormValidationBundle

This bundle performs validations of a form in javascript. (i18n compatible and several javascript frameworks supported)
92 stars 23 forks source link

New 'change' check mode #30

Closed bmurashin closed 11 years ago

bmurashin commented 11 years ago

I found a problem with 'blur' checks with jQueryUI datepicker widget field: field loses it's focus before widget updates it's value and validation error displayed, though value is correct. I've added a new 'change' check - it works nice with such widgets and behaves almost the same as 'blur'. I maintained BC, but had to introduce a new array option 'check_modes' spelled almost the same as former 'check_mode' - that can be confusing...

Abhoryo commented 11 years ago

The value returns by the datepicker plugin isn't yet filled its input, so the burl mode detects that the input is empty, right ?

You can break the BC, but add a warning message if the user have defined the 'both' mode, please.

bmurashin commented 11 years ago

Precise, that's "required" validator detects an empty field before it's filled. Ok to break BC, but what type for check_mode option to use - Array as I did or Scalar as it is now?

  1. Array give a control to specify any set of modes [submit, blur] or [submit, change], etc.
  2. Scalar requires to introduce a new constant for submit+change validation like both_change or whatever. Counter-intuitive I think.

Ok to change check_mode type to array? Should it stay check_mode or rename to check_modes (plural)?

Abhoryo commented 11 years ago

array + check_modes and output a warning if check_mode is defined.

bmurashin commented 11 years ago

Ok, I'll post new PR soon.

Abhoryo commented 11 years ago

ok thx