<c:form controller="user" action="save" bind="user">
<c:hidden name="id"/>
<c:input name="first_name"/>
<c:input name="last_name"/>
<c:buttons>
<c:submit label="save"/>
</c:buttons>
</c:form>
If you wanted to bind the form to 2 or more objects it would be cool if you could use a bind tag and group a set of elements within a form.
<c:form controller="student" action="save">
<c:bind key="user">
<c:hidden name="id"/>
<c:input name="first_name"/>
<c:input name="last_name"/>
</c:bind>
<c:bind key="student">
<c:input name="student_number"/>
</c:bind>
<c:buttons>
<c:submit label="save"/>
</c:buttons>
</c:form>
Or even better on the tag itself. (I think this available already, but I am not sure).
<c:form controller="student" action="save">
<c:hidden name="id" bind="user"/>
<c:input name="first_name" bind="user"/>
<c:input name="last_name" bind="user"/>
<c:input name="student_number" bind="student"/>
<c:buttons>
<c:submit label="save"/>
</c:buttons>
</c:form>
I like the idea. I'll add it to my list.
ReplyDeleteYou can now specify a bind attribute on individual form fields as well as wrap multiple form fields in a bind tag.
ReplyDelete<c:bind to="user">
<c:input name="firstName" />
<c:input name="lastName" />
<c:input name="userName" bind="profile" />
</c:bind>
Thanks. Much Appreciated.
ReplyDelete