[英]How to get checked items in gsp/groovy
I have code similar to as mentioned below.我有类似于下面提到的代码。
<g:each in="${Accounts}" var="account">
<li>
<g:hiddenField name="id" value="${account.id}" />
<g:hiddenField name="memberId" value="${account.memberId}" />
<g:hiddenField name="accountType" value="${account.type}" />
<label><input type="checkbox" />${member.name}</label>
</li>
</g:each>
In my groovy controller, I am trying to access the list of accounts checked by the user.在我的 groovy 控制器中,我试图访问用户检查的帐户列表。
Could somebody help me how I can get the checked items in my controller 'params'有人可以帮我如何在我的控制器“参数”中获取选中的项目
Thanks.谢谢。
GSP:普惠制:
<g:form controller="some" action="updateAccountIds">
<g:each in="${Accounts}" var="account">
...
<label><g:checkBox name="checkedAccount" value="${account.id}"/>${member.name}</label>
</g:each>
</g:form>
Controller action:控制器动作:
def updateAccountIds(){
def ids = params.list 'checkedAccount'
log.info "checked = $ids"
doOtherStuff()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.