Ticket #209 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

form-event for failed validation

Reported by: fries Owned by: mpo
Priority: minor Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: forms event validation Cc:

Description

There should be a way to catch an event when the validation finished. Maybe a boolean indicates whenever the form is valid or not. This could be handy to preform tasks that are not bound to 1 field or control.

Change History

comment:1 Changed 4 years ago by mpo

I've added this in [1279]. please confirm/comment if this fits your needs.
I'm leaving the ticket open until then.

Some notes:
The event has been added on the level of the control, so the form inherits this behaviour (being a special composite-control).

Event-handler registration is via control.validationFinished(function() { /* body */) });

In the event-handler body 'this' will refer to the control, meaning this.isValid(), this.valueState and this.validationMessages should offer you all needed info about the actual validation-state of the control.

On the order of things:

  • You can be sure the value is set prior to validation, so this.getValue() will give you the value that was validated.
  • However the valueChanged event can happen before or after this validationFinished depending on the validation being executed assynchronously (remote) or not resp.
  • Finally not all started validations are sure to finish: pending remote validations are ignored if a newer validation cycle is started.

comment:2 Changed 4 years ago by mpo

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.