Im creating a GSP form that i wish to submit using the $.ajax() call.
I understand that the GSPs get rendered into the final HTML that is seen by the browser, and thus javascript can call normal HTML elements.
my form is created as such:
<g:form action="save" id="callmeForm" >
<fieldset class="form">
<g:render template="form"/>
</fieldset>
<fieldset class="buttons">
<g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" />
</fieldset>
</g:form>
but when the final form is rendered in HTML, it lacks the id field i gave in the tag:
<form action="/racetrack/callback/save/callmeForm" method="post" >
<fieldset class="form">
etc...
Is there a way I can get the id property to carry thru so i can reference the form by its id with javascript?
You can use name attribute which sets both the form tag's name and id attributes to the same value.