API reference up.form
module

Features to submit and validate forms without a full page load.

Set an [up-submit] attribute to let Unpoly handle a form, or call up.submit() from JavaScript. The up:form:submit event lets your code observe or prevent any submission.

To render a new form state while the user is still typing, mark fields with [up-validate]. This shows validation errors as the user moves through the form, and can update other fields that depend on the changed value. [up-switch] shows, hides or disables other elements depending on a field's value, without a server request. [up-autosubmit] submits the form whenever a field changes, and up.watch() runs your own callback instead.


Features

  • Automatically submits a form when a field changes.

  • Automatically submits a form when a field changes.

  • Disables this element while an input field with [up-switch] has one of the given values.

  • Enables this element while an input field with [up-switch] has one of the given values.

  • [up-fieldset] ATTR deprecated

    Marks this element as a from group, which (usually) contains a label, input and error message.

  • Sets default options for form submission and validation.

  • Returns a list of form fields within the given element.

  • Returns the form group for the given element.

  • Marks this element as a form group, which (usually) contains a label, input and error message.

  • Returns whether the given element is a form field, such as input or select.

  • Returns whether the given form will be submitted through Unpoly instead of making a full page load.

  • This event is emitted when a form is submitted through Unpoly.

  • up.form.submitButtons(root) JS experimental

    Returns a list of submit buttons within the given element.

  • Parses the render options that would be used to submit the given form, but does not render.

  • When an [up-switch] field changes, this event is emitted on all dependent elements.

  • This event is emitted before a form is being validated.

  • Hides this element while an input field with [up-switch] has one of the given values.

  • [up-observe] ATTR deprecated

    Watches form fields and runs a callback when a value changes.

  • Observes form fields and runs a callback when a value changes.

  • Only shows this element if an input field with [up-switch] has one of the given values.

  • Submits a form via JavaScript and updates a fragment with the server response.

  • Submits this form via JavaScript and updates a fragment with the server response.

  • Controls the state of another element when this field changes.

  • Renders a new form state from its current field values, to show validation errors or update dependent elements.

  • Renders a new form state when a field changes, to show validation errors or update dependent elements.

  • Watches form fields and runs a callback when a value changes.

  • [up-watch] ATTR

    Watches form fields and runs a callback when a value changes.