Home

Formaction

Formaction is an HTML attribute used on form-associated controls such as input and button elements that submit a form. It specifies the URL to which the form's data will be sent for that particular submit action, overriding the form element's action attribute for that submission. The control can be part of the form or associated with it via the form attribute, which allows a single page to submit to different endpoints using different controls.

When a control with a formaction is activated, the browser uses the URL provided by formaction as

Compatibility: formaction is part of HTML5 and is supported by all major browsers, with very old browsers

Example: <form id="main" action="/process" method="post"> ... <button type="submit" formaction="/save" formmethod="post" formtarget="_self">Save</button> <button type="submit" formaction="/archive" formmethod="get" formtarget="_blank"

the
submission
target.
If
formaction
is
not
present
on
the
control,
the
action
attribute
of
the
form
is
used.
Formaction
works
together
with
related
form-level
attributes
such
as
formmethod,
formtarget,
and
formnovalidate
to
customize
the
submission:
formmethod
specifies
the
HTTP
method
(get
or
post),
formtarget
selects
the
browsing
context,
and
formnovalidate
disables
form
validation
for
that
submission.
lacking
support.
It
is
useful
when
a
form
must
submit
to
multiple
endpoints
without
duplicating
the
form
content.
formnovalidate>Archive</button>
</form>