Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 24869 invoked from network); 30 Nov 2007 18:51:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Nov 2007 18:51:44 -0000 Received: (qmail 70540 invoked by uid 500); 30 Nov 2007 18:51:21 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 70346 invoked by uid 500); 30 Nov 2007 18:51:21 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 70334 invoked by uid 99); 30 Nov 2007 18:51:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2007 10:51:21 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.221.240.217] (HELO premierinc.com) (216.221.240.217) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2007 18:51:01 +0000 Received: from ([10.32.2.81]) by c3smtp04.premierinc.com with ESMTP id 4028744.109903943; Fri, 30 Nov 2007 13:50:43 -0500 Received: from C3EXCHANGE.corp.premierinc.com ([10.32.2.82]) by c3piexchfe2.corp.premierinc.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 30 Nov 2007 13:50:41 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: RE: [S2] Checkboxes Date: Fri, 30 Nov 2007 13:50:43 -0500 Message-ID: <4952B1779A19A94F8A5D2F96B64624DAEB49B3@C3EXCHANGE.corp.premierinc.com> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [S2] Checkboxes Thread-Index: Acgza4Hj9I9W7jxAQHWv5Um3VX1LuQAFDA8g From: "Hoying, Ken" To: "Struts Users Mailing List" X-OriginalArrivalTime: 30 Nov 2007 18:50:41.0323 (UTC) FILETIME=[E7D31FB0:01C83381] Content-Type: text/plain; charset="us-ascii" X-Virus-Checked: Checked by ClamAV on apache.org Thank you for the response=2E=0D=0A=0D=0AI had looked at the example, but i= t really appears to only push the=0D=0Acheckbox results to the action=2E I= am not sure that it would repopulate=0D=0Athe checkbox with the values=2E= =0D=0A=0D=0AI do not believe that checkbox list is going to work for me as = it does=0D=0Anot give me control on where to put the checkboxes=2E I need = one in each=0D=0Arow=2E=0D=0A=0D=0AIt appears that my understanding of how = the checkbox works is not=0D=0Acorrect=2E=0D=0A=0D=0AI am expecting that th= e checkbox control will call the=0D=0AgetSelectedContracts() method and see= if any of these values in the=0D=0Aarray it returns matches the value spec= ified in the fieldValue attribute=0D=0Aspecified in the checkbox tag=2E If= there is a match then check the box,=0D=0Aif not don't check it=2E Howeve= r, all of my checkboxes are always being=0D=0Aselected no matter what=2E=0D= =0A=0D=0AI am also expecting that when submitting the form,=0D=0AsetSelecte= dContracts() will be called with an array of the values that=0D=0Awere sele= cted=2E This does appear to be working with one caveat=2E If=0D=0Anothing = is selected then I get the error: Invalid field value for field=0D=0A"selec= tedContracts"=2E=0D=0A=0D=0AThis obviously does not work the way I thought = and I was hoping someone=0D=0Acould maybe explain how it does work as I am = really struggling on=0D=0Againing an understanding of this tag and its usag= e=2E=0D=0A=0D=0AThanks in advance,=0D=0AKen=0D=0A=0D=0A-----Original Messag= e-----=0D=0AFrom: Martin Gainty [mailto:mgainty@hotmail=2Ecom] =0D=0ASent: = Friday, November 30, 2007 11:09 AM=0D=0ATo: Struts Users Mailing List=0D=0A= Subject: Re: [S2] Checkboxes=0D=0A=0D=0AHi Ken-=0D=0A=0D=0Astruts=2Exml has= this definition of EmployeeAction where results populate=0D=0AeditEmployee= =2Ejsp=0D=0A =0D=0A = /empmanager/editEmployee=2Ejsp=0D= =0A edit-${currentEmployee=2EempI= d}=2Eaction=0D=0A =0D=0A=0D=0Alooking at the resul= ts jsp=0D=0A/empmanager/editEmployee=2Ejsp has a checkbox defined as =0D=0A=0D=0AThe EmployeeAction is defined as=0D=0Apackage or= g=2Eapache=2Estruts2=2Eshowcase=2Eaction;=0D=0Apublic class EmployeeAction = extends AbstractCRUDAction implements=0D=0APreparable { private Employee c= urrentEmployee;=0D=0A=0D=0Awhereas Employee is defined as=0D=0Apackage org= =2Eapache=2Estruts2=2Eshowcase=2Emodel;=0D=0Apublic class Employee implemen= ts IdEntity {=0D=0A private boolean married; //checkbox=0D=0A=0D=0Aso th= e individual checkbox works fine for setting booleans=0D=0Ahttp://struts=2E= apache=2Eorg/2=2E0=2E11/docs/checkbox=2Ehtml=0D=0A=0D=0AFor handling a list= of checkboxes you may want to implement with=0D=0Acheckboxlist?=0D=0Ahttp:= //struts=2Eapache=2Eorg/2=2E0=2E11/docs/checkboxlist=2Ehtml=0D=0A=0D=0AM--= =0D=0A----- Original Message -----=0D=0AFrom: "Hoying, Ken" =0D=0ATo: =0D=0ASent: Friday, Nov= ember 30, 2007 8:45 AM=0D=0ASubject: [S2] Checkboxes=0D=0A=0D=0A=0D=0AI am = having a difficult time getting checkboxes to work in the following=0D=0Asc= enario and am not sure what I am doing wrong=2E Any help or guidance=0D=0A= would be greatly appreciated=2E=0D=0A=0D=0AI have table which displays seve= ral rows=2E In the first column of each=0D=0Arow, I have a check box to se= lect that row=2E I am keeping track of user=0D=0Aselections so when they r= eturn to the page, the checkboxes are=0D=0Aprepopulated with their previous= selections=2E=0D=0A=0D=0A=0D=0AMy Action contains the following:=0D=0A=0D= =0Apublic Long[] getSelectedContracts()=0D=0A{=0D=0Areturn setSelectedContr= acts=2EtoArray(new Long[0]); } // end=0D=0AgetSelectedContracts=0D=0A=0D=0A= /**=0D=0A* This setter takes the provided String[] of selected contract ids= =2E=0D=0A*/=0D=0Apublic void setSelectedContracts(Long[] palngSelectedContr= acts)=0D=0A {=0D=0A=0D=0AsetSelectedContracts=2EaddAll(Arrays=2EasList= (palngSelectedContracts));=0D=0A} // end setSelectedContracts=0D=0A=0D=0AMy= JSP contains the following:=0D=0A=0D=0A=0D=0A=0D=0A=0D=0A=0D= =0A=0D=0A=0D=0A=0D=0A-----------------------------------------=0D=0A***Note= :The information contained in this message may be privileged and=0D=0Aconfi= dential and protected from disclosure=2E If the reader of this=0D=0Amessage= is not the intended recipient, or an employee or agent=0D=0Aresponsible fo= r delivering this message to the intended recipient, you=0D=0Aare hereby no= tified that any dissemination, distribution or copying of=0D=0Athis communi= cation is strictly prohibited=2E If you have received this=0D=0Acommunicati= on in error, please notify the Sender immediately by replying=0D=0Ato the m= essage and deleting it from your computer=2E Thank you=2E Premier=0D=0AInc= =2E=0D=0A=0D=0A=0D=0A------------------------------------------------------= ---------------=0D=0ATo unsubscribe, e-mail: user-unsubscribe@struts=2Eapac= he=2Eorg=0D=0AFor additional commands, e-mail: user-help@struts=2Eapache=2E= org=0D=0A=0D=0A=0D=0A-----------------------------------------=0D=0A***Note= :The information contained in this message may be privileged=0Aand confiden= tial and protected from disclosure=2E If the reader of=0Athis message is no= t the intended recipient, or an employee or agent=0Aresponsible for deliver= ing this message to the intended recipient,=0Ayou are hereby notified that = any dissemination, distribution or=0Acopying of this communication is stric= tly prohibited=2E If you have=0Areceived this communication in error, pleas= e notify the Sender=0Aimmediately by replying to the message and deleting i= t from your=0Acomputer=2E Thank you=2E Premier Inc=2E --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org