如何将groovy变量和javascript值传递给grails控制器?

时间:2014-05-24 07:16:05

标签: grails groovy gsp

<td><g:field type="number" name="deadlineFT" value="${selectedMilestone.deadlineFT}"
            onchange="${remoteFunction(action: 'updateMilestone', params: [id: selectedMilestoneID, item:'deadlineFT', value: this.value])}"/> Months</td>

selectedMilestoneID是一个groovy变量。上面的代码无效,因为groovy无法识别this.value。但是,如果我使用params: '\'value\'+this.value,则无法获得selectedMilestoneID

有没有办法获得这两个值?

1 个答案:

答案 0 :(得分:0)

试试这个:

<g:field type="number" name="deadlineFT" value="${selectedMilestone.deadlineFT}"
       onchange="${remoteFunction(action: 'updateMilestone',
       params: "'id=${selectedMilestoneID}&value='+this.value")}"/>