-
-
Notifications
You must be signed in to change notification settings - Fork 35
Add g:formActionSubmit for client submission to multiple form urls #551
Comments
This change would have the added benefit of not relying on custom url mappings per the documentation here: https://gsp.grails.org/latest/ref/Tags/actionSubmit.html or default actions. |
@jdaugherty perhaps you could provide more detail in this ticket description on how existing behavior works and how it will be changed. Specifically, how existing html is generated by the tag. I don't use this tag. It currently works by generating inline javascript? |
Prior to HTML5, an HTML form without any JavaScript could only submit to the URL specified in it's This allows for submitting multiple actions depending on the button clicked via server side code. It's implemented server side via Given this example
This will generate the following HTML code:
When the user clicks on the button "Call the update action", the form will submit to When the user clicks on the button "Call the other Test Action", the form will be submitted to Now that HTML5 has a valid way to invoke different URLs for a form, it makes sense to add a tag that supports the client side mechanism. I propose we deprecate the tag |
An example project of the existing behavior is here: https://github.com/jdaugherty/grails-dual-action-submit-example You can open the url |
For this proposal, given this code:
It would generate this html:
Clicking |
Ok, but won't you need a PR in grails-core deprecating the Url Mapping functionality? |
@codeconsole apache/grails-core#13905 will mark the grails-core code deprecated |
As of HTML5, the input attribute formaction is the accepted way to submit to different URLs for a form on the client side with no javascript. This attribute is widely supported across all browsers:
I'd like to propose we adopt a tag
formActionSubmit
instead of implementing a server side solution via the tagactionSubmit
(it uses a parameter with the formataction_${actionName}
to submit to different actions for the same controller).The text was updated successfully, but these errors were encountered: