fields
fields copied to clipboard
Support of Command beans with @Validateable annotation
I have RegisterCommand used in register action. This command is marked by '@Validateable' annotation. When I try to render form with it, I get org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [all] currently only supports domain types. As I can understand, it is possible to implement this feature. Could you implement it? Thanks
This is a fairly major restriction on the use of the f:all tag and breaks the use the fields plugin with the modern Command Object support that is, on many people's, best practices list.
+1 for supporting this request.
:+1:
Please check with release 1.5. I think it is possible now.
Reply to self: No it is not possible with <f:all bean="${someCommand}"/>
This request is stil valid.
The title of this issue is currently "Support of Command beans with @Validateable annotation". Does the Validateable annotation have anything to do with this or is it just about any non-domain class bean?
https://github.com/grails-fields-plugin/grails-fields/blob/9934df182727e5082ad2be8e6d5bbc4d09e818a1/grails-app/taglib/grails/plugin/formfields/FormFieldsTagLib.groovy#L100
+1 we need this.
I believe this affects <f:with /> as well.
This is the sample exception that I got by doing command objects that implements Validateable.
Bear in mind that command objects are being put inside src/main/groovy because you don't want those classes to create schema inside the db.
Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/testSpeakerInfo.gsp:20] Error executing tag <g:form>: [views/testSpeakerInfo.gsp:19] Error executing tag <f:with>: [views/testSpeakerInfo.gsp:14] Error executing tag <f:field>: Invalid property 'name' of bean class [java.lang.String]: Bean property 'name' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?