Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Question about sequence of events

    I have a FormItem to which I have attached both a CustomValidator and a ChangedHandler. I've also setChangeOnKeypress(false). I'm having difficulty understanding the sequence of events. Will the ChangedHandler only be fired after the CustomValidator?

    The behavior I'm looking for is this. After the user types a new value in the field, validate the value and then, only if it passes validation, proceed to do some other stuff. Is this the right approach?

    #2
    Change is always pre-validation, but the order of Changed and validation is settings-dependent (some validators have an async server trip).

    What specifically do you mean by "after the user types a new value in the field"? This sounds like you're really trying to wait until the user pauses briefly in typing (like the ComboBoxItem) does. In that case, you'd be setting/resetting a timer after each keystroke so you'd run after both Changed and Validation.

    Comment


      #3
      I need to execute some code after the field value has been changed AND it has passed validations. I have validateOnExit(true), so I want the validations to happen when they tab out of the field, then if all validations have passed, execute my method.

      Comment


        #4
        Changed is called after validation triggered by a validateOnChange setting. If you have validateOnExit and not validateOnChange (and changeOnKeypress) you can use a blur handler instead. Note that in all of these cases, the handler is called even if validation fails. You can check the form hasFieldErrors(fieldName) to see if the field is valid before starting you logic.

        Comment

        Working...
        X