Sets default options for form submission and validation.
An array of CSS selectors matching forms that will be submitted through Unpoly.
You can configure Unpoly to handle all forms on a page without requiring an [up-submit]
attribute:
up.form.config.submitSelectors.push('form')
Individual forms may opt out with an [up-submit=false]
attribute.
You may configure additional exceptions in config.noSubmitSelectors
.
Exceptions to up.form.config.submitSelectors
.
Matching forms will not be submitted through Unpoly,
even if they match up.form.config.submitSelectors
.
An array of CSS selectors matching a form group.
When validating a field, Unpoly will re-render the closest form group around that field.
When a group is matched, Unpoly will derive a target selector for the element.
In the example below, changing the City field would validate the target #city_group
:
<fieldset id="city_group">
<label for="city">City</label>
<input type="text" name="city" id="city" up-validate>
</fieldset>
If no good selector cannot be derived from the group element, the resulting target will
use a :has()
suffix that matches the changed field. In the example below the target
would be fieldset:has(#city)
:
<fieldset> <!-- no [id] attribute to derive a selector from -->
<label for="city">City</label>
<input type="text" name="city" id="city" up-validate>
</fieldset>
An array of CSS selectors that represent form fields, such as input
or select
.
When you add custom JavaScript controls to this list, matching elements should respond to the properties { name, value, disabled }
.
An array of CSS selectors that represent submit buttons, such as input[type=submit]
.
The number of milliseconds to wait before running a watcher callback.
This default delay is only applied when watching the input
event.
There is no default delay when watching other types of events.
An array of events to substitute if watching the input
event.
This can be used to watch misbehaving fields
that don't emit the standard input
event
as its value is being edited.
It's OK to name multiple events that may result in the same change (e.g. ['keydown', 'keyup']
).
Unpoly guarantees the callback is only run once per changed value.
Instead of configuring an array of event types, you may also set a function that accepts a form field and returns an array of event types to watch for that field.
An array of events to substitute if watching the change
event.
This can be used to watch misbehaving fields
that don't emit the standard change
event
after its value was changed.
It's OK to name multiple events that may result in the same change (e.g. ['change', 'blur']
).
Unpoly guarantees the callback is only run once per changed value.
Instead of configuring an array of event types, you may also set a function that accepts a form field and returns an array of event types to watch for that field.