Re: Binding to dynamic checkbox in an array doesn't work.
Lachezar Dobrev <[email protected]> Sat, 28 Aug 2010 14:16:32 +0300
| Newsgroups | gmane.comp.java.springframework.user |
|---|---|
| Message-ID | <[email protected]> |
Check-box value should not be 'false', because whether you check the
box (and receive false) or not (and receive nothning)
Try value="true". Not value="${true}" although it will work.
Also you might want to create a hidden input to turn off unchecked
boxes: http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/bind/WebDataBinder.html#setFieldMarkerPrefix%28java.lang.String%29
2010/8/27 Kannan Jayaprakasam <[email protected]>:
> Inside nested forEach loops I’m dynamically creating textbox and checkboxes
> as below. Value set in the textbox is getting passed to the controller, when
> the form is submitted, but the checkbox value is always passed as false,
> even when checked. I even looked at the request parameter available to the
> Controller, it is false as well.
>
>
>
> <spring:bind
> path="refreshCache.instanceDetails[${instanceLoopStatus.index}].modulesRunning[${moduleLoopStatus.index}].serviceUrl">
>
>
> <input type="text" name="${status.expression}" value="${status.value}"/>
>
>
> </spring:bind>
>
>
> <spring:bind
> path="refreshCache.instanceDetails[${instanceLoopStatus.index}].modulesRunning[${moduleLoopStatus.index}].checked">
>
>
> <input type="checkbox" name="${status.expression}" value="${status.value}"/>
>
>
> </spring:bind>
>
>
>
> Why is this happening? I’m clueless. Please help.
>
>
>
> --Kannan
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Springframework-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/springframework-user
>
>
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d