Use “name” to add an “id” attribute to g:form (in Grails)

If you want to use the simple syntax <g:form action=’myaction’ />, adding id=”x” will result in a form post to /myaction/x – to get a post to /myaction with a form id attribute of “x”, use the name attribtue instead, as <g:form action=’dologin’ name=’x’ />, per this thread: https://jira.grails.org/browse/GRAILS-895

Alternately, you can use the syntax <g:form url=”[action:’myaction’]” id=”x”>, but that may present other issues.

No Comments

Leave a Reply

Your email is never shared.Required fields are marked *