Illep
Illep

Reputation: 16851

grails setting value to hidden field

I need to have a hiddenfield with the value of the current user logged in.

I know how to get the current user logged in. <sec:loggedInUserInfo field="username" />

But how can i set it to a hidden field ?

Upvotes: 0

Views: 4966

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

It's simple enough. Something like this perhaps:

<input type="hidden" name="whateverYouWant" value="${sec.loggedInUserInfo(field: 'username')}" />

Or if you prefer to use the hiddenField tag:

<g:hiddenField name="whateverYouWant" value="${sec.loggedInUserInfo(field: 'username')}" />

Upvotes: 3

Related Questions