I'm adding a custom error
trip.errors.rejectValue('driver','Driver already on a trip at this time.')
When I output the error in a view....
<g:hasErrors bean="${trip}" field="driver">
<g:renderErrors bean="${trip}" field="driver" as="list" />
</g:hasErrors>
....a fully qualified field path gets appended to it.
"Driver already on a trip at this time. org.heidelberg.Trip.driver"
How can I get rid of the org.heidleberg.Trip.driver
part that is applied?
Your method calling is incorrect. Try this -
trip.errors.rejectValue('driver',null,'Driver already on a trip at this time.')
it should work fine. The correct method signature of rejectValue method is
void rejectValue(String field, String errorCode, String defaultMessage
Cheers!!