tags:

views:

159

answers:

1

I'm coming from a Spring MVC background on a new Grails app. I have an object that contains a list of dependent objects. On the create and edit screen, I want to edit that object and its list of objects at the same time. In Spring MVC, you could use special names to bind the form fields to items in a list. Example:

Entity { String name, List items }

<form:input name="entity.items[0].value" value="${entity.items[0].value}"/>

I've tried similar variations in my GSP create and edit forms, but no luck.

+1  A: 

I haven't used this with tag (is it a Java taglib?), but what you are doing is along the right path. I don't think you need the entity in there, the name should be just "items[0].value"

Here is some code I have that does what you need (using HTML input tag):

<input type="text" name="subItems[0].date"/>
Jean Barmash
Yeah, it's a Spring WebMVC taglib.And you are right, that works! My problem is that I was trying to use the gsp tag like so: <g:textField name="subItems[0].date"/> and this throws a runtime exception.Any ideas on how to make it work for <g:textField/> ?
Mike