mzzzzb
mzzzzb

Reputation: 1452

Grails 3 fields plugin generating form elements from a command object

I am running grails 3.0.4 and I have a simple command object AdvanceCommand I am trying to create a form for all the fields in the command object using f:all tag from fields plugin. But I get an error

[views/advance/create.gsp:35] [views/advance/create.gsp:30] Tag [all] currently only supports domain types

the documentation specifically mentions command objects so I am a bit confused. if this tag is not working how do I generate form elements for a command object?

This is a snippet from my controller

def create() {
    respond new AdvanceCommand()
}

and this is my gsp

        <g:form action="save">
            <fieldset class="form">
                <f:all bean="advanceCommand"/>
            </fieldset>
            <fieldset class="buttons">
                <g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" />
            </fieldset>
        </g:form>

PS in the source repo of field plugin the latest version is 1.5.1 but if I run plugin-info I get 2.0.3 and 1.5.x is not even mentioned. Am I using a different plugin ?

grails> plugin-info fields
| Plugin Info: fields
| Latest Version: 2.0.3
| All Versions: 2.0.0.M1,2.0.0,2.0.1,2.0.2,2.0.3
| Title: Fields Plugin

Customizable form-field rendering based on overrideable GSP template

* License: APACHE
* Documentation: https://grails-fields-plugin.github.io/grails-fields
* Issue Tracker: https://github.com/grails-fields-plugin/grails-fields/issues
* Source: https://github.com/grails-fields-plugin/grails-fields

Upvotes: 2

Views: 1906

Answers (1)

mzzzzb
mzzzzb

Reputation: 1452

It appears they have forked a fields plugin from 1.4 to support grails 3. New documentation and source repo.

There is a feature request to support non domain objects in <f:all>. so it looks like its not supported yet. Using <f:field> seems to be the only way out

Upvotes: 2

Related Questions