I am having hard time getting hasErrors to work with indexed properties. For example
class Order {
String prop1
String prop2
static hasMany = [items: Item]
}
class Item {
String name
static constraints = {
name(blank:false)
}
}
Validation works properly and on item.name being blank I do get an error with
<g:renderErrors bean="${orderInstance}"/>
However, I am trying to have input box highlighted using hasErrors :
<g:each in="${orderIntsance.items}" status="i" var="item">
<span class="field ${hasErrors(bean: orderInstance, field: ????????? , 'errors')}">
<g:textField name="items[${i}].name" value="${item?.name}"/>
</span>
</g:each>
Not sure how to get to it with a field: property, any ideas?
Thanks