Edit this page

up.form up:form:validate
DOM event

This event is emitted before a form is being validated.

Listeners can inspect, modify or prevent the render pass that will load and show the validation results.


Validation

event.target
required

The form that is being validated.

event.form
required

The form that is being validated.

event.params
required

The form parameters that will be sent as the form's request payload.

Listeners may inspect and modify params before they are sent. Note that the request may be a batch of multiple validations.

event.fields
required

The form fields that triggered this validation pass.

When multiple fields are validating within the same task, Unpoly will make a single validation request with multiple targets.

The names of the validating fields are also sent as an X-Up-Validate request header.

Render pass

event.renderOptions
required

An object with render options for the fragment update that will show the validation results.

Listeners may inspect and modify these options.

Note that the request may be a batch of multiple validations. In that case event.renderOptions will contain the merged render options for every targeted fragment. Unpoly will try to merge render options where possible (e.g. { headers, target }). When a render option cannot be merged (e.g. { scroll }), the option from the last validation in the batch will be used.

event.preventDefault()
required

Prevents the validation request from being sent to the server.