<!--Generates a label of 'Update' submitting to `update` action on the current controller-->
<g:formActionSubmit value="Update" />
<!--'Update' is action, label is 'Some update label'-->
<g:formActionSubmit value="Some update label" action="update" />
<!--'Update' is action on the controller 'index', label is 'Some update label'-->
<g:formActionSubmit value="Some update label" controller="index" action="update" />
<!--label derived from message bundle-->
<g:formActionSubmit value="${message(code:'label.update')}" action="update" />
<!-- will submit to the default action & current controller with a button label of `Delete`-->
<g:formActionSubmit value="Delete" />
<!-- will submit to the default action & current controller with a button label of `DeleteAll`; a javascript confirmation will be triggered -->
<g:formActionSubmit value="DeleteAll"
onclick="return confirm('Are you sure???')" />
formActionSubmit
Purpose
Creates a submit button that sets the formaction
attribute, which allows one to submit to multiple different actions across different controllers. The formaction
URL will be generated by the various link attributes.
Examples
Description
Attributes
-
value
(required) - The caption of the button and name of action when not explicitly defined. -
id
(optional) - The element id of the input element -
action
(optional) - The name of the action to use in the link; if not specified the default action will be linked -
controller
(optional) - The name of the controller to use in the link; if not specified the current controller will be linked -
namespace
(optional) - The namespace of the controller to use in the link -
plugin
(optional) - The name of the plugin which provides the controller -
id
(optional) - The id to use in the link -
fragment
(optional) - The link fragment (often called anchor tag) to use -
mapping
(optional) - The {grailsdocs}guide/theWebLayer.html#namedMappings[named URL mapping] to use to rewrite the link -
method
(optional) - The HTTP method specified in the corresponding URL mapping -
params
(optional) - A map containing URL query parameters for the link -
url
(optional) - A Map containing the action, controller, id etc. -
uri
(optional) - A string for a relative path in the running app. -
relativeUri
(optional) - Used to specify a uri relative to the current path. -
absolute
(optional) - Iftrue
will prefix the link target address with the value of thegrails.serverURL
property from the application configuration, or http://localhost:<port> if there is no setting in the config and not running in production. -
base
(optional) - Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of theabsolute
property if both are specified. -
event
(optional) - The name of a Webflow event to trigger for the flow associated with the givenaction
. Requires the Webflow plugin.
When you use a normal submit button inside a form, it is the form itself that determines what URL the request is sent to, and therefore what action is executed. However, this tag overrides that behaviour and determines which action is executed by the specified attributes. This tag supports any controller & action.