Hi. First of all: Thx u ! I thought about your advice this week but wanted to know whether there are solutions without javascript, guess I found the simplest method, although I don't know whether it's common practise with struts.
have u ever tried to do it like this : ? <html:checkbox property="adress" value="true"/> <html:hidden property="adress" value="false"> I'm not at work, not able to test it. I just read about that struts always just reads the first line ? When checkbox is unchecked html:hidden is send to the server, otherwise checkbox with value true !! So I just need to add a single line to my jsp and will test it on monday ! thx you Cheers, REinhard -------- Original-Nachricht -------- > Datum: Fri, 30 Jan 2009 13:20:36 +0100 > Von: "Sébastien Domergue" <sebastien.domer...@c-s.fr> > An: Struts Users Mailing List <user@struts.apache.org> > Betreff: Re: checkboxes > Hi, > > We had the same problem with a checkboxlist. Actually, a html checkbox > does not send a data if it's unchecked. In a simple form, no data means > false so we don't see anything. In a list, that means there are only the > number of true which correspond to the number of checkbox checked. > In order to have a value every time, we create an hidden field with the > checkbox. In the checkbox onchange field there is a small javascript > code that updates the hidden field value (with this method, youh have to > use the status field form iterator). To use data, the checkbox are in > charge of reading from previous action and the hidden fields are in > charge of writting for the next one. > > Regards > > Sébastien > > > Reinhard Wagner a écrit : > > Hi. > > > > I do have 2 lists in my formbean, one for the checkoxtypes[A,B,C,D] and > one for knowing which checkbox is on / off [checkboxstate] > > > > In my jsp I do iterate over the checkboxtypes List and for every > checkboxtype I generate a struts:checkbox with property set to > checkboxstate[index] and value = 1 ; All works fine except that I'm facing > prolem when > checkbox isn't checked in my formbean. Then there are of course only 2 > elements > in my checkboxstate list which means that indexes aren't in the right order > anymore [when for example 2nd box was unchecked... ] .. > > > > So in short, is there an easy workaround for this problem. I do have to > show the user checked and unchecked buttons ? > > > > I'm completely new to struts, that's why I'm asking. > > > > THanks in advantage > > > > Rudi > > > > > -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org