g:渲染形式:输入字段不会预先填充

时间:2013-06-03 20:56:48

标签: grails

我从我的控制器传递数据: controller.groovy

render(view: "printme", model: [patient: patient, behandlungInstance: behandlung, frage1Instance: frage1]);

到printme.gsp,从printme.gsp获取:

<g:render contextPath="../frage1" model="['frage1Instance':frage1Instance]" template="form"/>

到frage1 / _form.gsp。

当我写作

render(view: "printme", model: [patient: patient, behandlungInstance: behandlung, frage1Instance: frage1]);

一切正常,“frage1”的输入字段预先填写,但是当我写作时

 render(view: "printme", model: [patient: patient, behandlungInstance: behandlung, 
        frage1Instance: frage1, frage2Instance: frage2]);

“frage1”的输入字段不会预先填充。

更新: frage1 / _form.gsp

的示例
    <div class="fieldcontain ${hasErrors(bean: frage1Instance, field: 'sub1', 'error')} required">
    <label class="rm_pre" for="sub1">
        <g:message code="frage1.sub1.label_pre" default="Sub1" />
    </label>
    <g:radioGroup name="sub1" values="[-3,-2,-1,1,2,3]" disabled="${session.disabled }" value="${frage1Instance?.sub1}" >
        <span style="padding-left: 5px; padding-right: 5px">${it.radio}</span>
    </g:radioGroup>
    <label class="rm_post" for="sub1">
        <g:message code="frage1.sub1.label_post" default="Sub1" />
    </label>
</div>

这里的问题是什么?

谢谢:)

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。问题是,某些输入标签的名称相同。