Re: Binding to dynamic checkbox in an array doesn't work.
Kannan Jayaprakasam <[email protected]> Mon, 30 Aug 2010 22:57:22 -0700
| Newsgroups | gmane.comp.java.springframework.user |
|---|---|
| Message-ID | <[email protected]> |
The value attribute of the checkbox was 'false' even though the checked attribute was 'true' when it was checked. That seems weird, I got it resolved by setting this.value=this.checked; in the onclick action. Thanks kannan -----Original Message----- From: Lachezar Dobrev [mailto:[email protected]] Sent: Saturday, August 28, 2010 4:47 PM To: List for Spring users Subject: Re: [Springframework-user] Binding to dynamic checkbox in an array doesn't work. 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 _______________________________________________ Springframework-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/springframework-user ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd