I have a form where I have to have the input elements ordered specifically. So my form looks something like this:
<input type="text" name="name"/>
<select name="contacts.first">...</select>
<select name="contacts.second">...</select>
...
I have a command object that I'm trying to use to validate this form. However, I can't seem to get it to map correctly. My command object looks like this:
@Validatable
class MyCommand {
def name
def contacts
static constraints = { /* ... */ }
}
My controller action looks like:
def update = { MyCommand cmd ->
if (cmd.validate()) {
/* ... */
}
}
When I look at cmd.contacts
, it's null. If I name each select just contacts
instead of contacts.first
, it is an array of values as expected, but I did not want to depend on the browser to make sure these items are in a specific order. Any suggestions to making this work? The correct order is crucial.