Jon
Jon

Reputation: 1089

Grails form tag ID property for css

When you use grails form tag how can you have an id selector in the rendered HTML form tag?

If you use

<g:form action="register" controller="registration" id="registrationform"/>

it renders the form post URL as the /registration/register/registrationform.

Is there a way to provide a property that renders ?

Upvotes: 6

Views: 2151

Answers (1)

Gregg
Gregg

Reputation: 35904

Easiest way is

<g:form action="register" controller="registration" name="registrationForm" />

The name attribute will be used to render the id attribute

You could also use the URL parameter and pass in a map for your action and controller.

<g:form url="[action:'register', controller:'registration']" id="registrationForm" />

Upvotes: 12

Related Questions