Edit this page

up.form [up-submit]
HTML selector

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

The server must render an element matching the target selector from the [up-target] attribute. A matching element in the current page is then swapped with the new element from the server response. The response may include other HTML (even an entire HTML document), but only the matching element will be updated.

The programmatic variant of this is the up.submit() function.

Example

<form method="post" action="/users" up-submit up-target=".content">
  ...
</form>

Handling validation errors

When the form could not be submitted due to invalid user input, Unpoly can re-render the form with validation errors.

See validating forms for details and examples.

Showing that the form is processing

See navigation feedback and disabling form controls while working.

Short notation

You may omit the [up-submit] attribute if the form has one of the following attributes:

Such a form will still be submitted through Unpoly.

Handling all forms automatically

You can configure Unpoly to handle all forms on a page without requiring an [up-submit] attribute.

See Handling all links and forms.


Modifying attributes

Info

All attributes for [up-follow] may be used.

[up-target] optional

The target selector to update for a successful form submission.

[up-fail-target] optional

The target selector to update when the server responds with an error code.

Defaults to the form element itself.

See Handling failed responses.

[up-disable] optional

Whether to disable form controls while the form is submitting.