Announcement

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

    Validate onChange only?

    Hi,

    com.smartgwt.client.widgets.form.validator.Validator.setValidateOnChange(Boolean) ::

    If true, validator will be validated when each item's "change" handler is fired as well as when the entire form is submitted or validated.
    I'm looking for a validator which only fires when the user changed a value. It should not validate existing values coming from the server (even when the user canEdit the field).
    We always call form.validate() before any server interaction. When that happens, this validator should not run. Or run only when the value has changed.

    As workaround we would add the validator on the field as usual, add some attribute onItemChanged to the field and let the validator check that property to see if it should run. The attribute needs to be reset after every server interaction then.
    Is there something easier in the framework?



    thanks,

    #2
    Without knowing anything about why such a validator would be useful or what kind of rule it's enforcing, all we can say is that your approach of deactivating the validator during non-change events seems fine.

    Comment

    Working...
    X