Tengo lo sgte:
class ActionPlanTemplate implements Serializable{
String name
static hasMany = [actionPlans: ActionPlan]
......
}
class ActionPlan implements Serializable{
String modelName
Date realStartDate
......
}
En mi form:
<td><input type="text" mydatepicker name="actionPlans[{{num}}].realStartDate" ng-model="actionTemplate.actionPlans[num].realStartDate"/></td>
In my controller I will try save ActionPlanTemplate with their ActionPlans:
def save(ActionPlanTemplate apt) {
def method = "save"
def result, actionPlans = []
try {
ActionPlanTemplate.withTransaction {
println apt
apt.actionPlans.each{ ap ->
ap.realStartDate = new Date()
println "b" + ap.realStartDate
if (!ap.save(flush:true)) {
ap.errors.allErrors.each { println it }
}
}
if (!apt.save(flush:true)) {
apt.errors.allErrors.each { println "i------" + it }
}
println apt.actionPlans
}
return redirect (controller:'actionPlanTemplate', action: 'index')
} catch (Exception e){println "e---------" + e}
}
El error que estoy cogiendo es:
Field error in object 'com.analysis.model.ActionPlan' on field 'startDate': rejected value [10/03/2018]; codes [com.analysis.model.ActionPlan.startDate.typeMismatch.error,com.analysis.model.ActionPlan.startDate.typeMismatch,actionPlan.startDate.typeMismatch.error,actionPlan.startDate.typeMismatch,typeMismatch.com.analysis.model.ActionPlan.startDate,typeMismatch.startDate,typeMismatch.java.util.Date,typeMismatch]; arguments [startDate]; default message [Unparseable date: "10/03/2018"]