Jim, Thanks for you reply. But I really don't want to clear all my check boxes. When I display my list for the first time I want to show the checkboxes checked or unchecked depending on the boolean value of one of the attribute of iterating object. Say my page displays first 25 records. I have "Next" button on screen to view next 25 records and so on. I check some boxes on the first screen and click the "Next " button. On second screen I check some more records. On this screen I have a "Previous" button to go back to first 25 records. When I click "Previous" button then it will take me to the first screen and it should remember my previous changes and not showing screen with all records unchecked.(which happens in normal behaviour due to Reset method of form where we set checkbox property to false.) How do I achieve the above? Also we are using Dynaforms here. Can I still have the form class with reset method? This is little bit different then normal use of check box in struts. Can you please guide me here. Thanks and Appreciate your help, Jignesh
Jim Barrows <[EMAIL PROTECTED]> wrote: > -----Original Message----- > From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 19, 2004 5:19 PM > To: Struts Users Mailing List > Subject: Re: dealing with check boxes > > > Anuj, > Thanks for you reply. But My concern is as follows. > > e.g. > > I display these records with checkbox on my JSP as follows > > property="Name of the property"> > > > .... > > > In this case "list" is id on which is going to iterate. > chkflag is the boolean property of an object contained in the > list(can be collection or arraylist). depending on this it is > going to decide whether the checkbox should be checked or not. > > Now How do I capture these changes which I do on the > screen(checking and unchecking of check boxes) in my Action > class so that it can be store the changes and display them > when I come back to the same screen. > > Let me know if still it is not clear. Read the tutorials and you'll get a better idea of how to do this. Make sure that you have the reset method changing all your checkboxes to false. That's a key piece most people miss. As with every other field in a struts form, you don't have to do anything, except as I mentioned above. If you aren't using a form, then the browser only sends those boxes that are checked (iirc). Which means all kinds of fun will ensue. > > Thanks, > Jignesh > > [EMAIL PROTECTED] wrote: > > > Jignesh, > > I think your problem is not related to checkbox or multibox > but to maintain a > list of modified records. To keep it simple I would suggest > that you maintain a > Collection (Map, HashMap, List, etc.) of the modified records > (which were > checked or unchecked) in the session. I think you can > identify the records that > are modified on each page so just put them in the collection > and put the > collection in session so that you have it for all the pages. > Update your list > that you display in the jsp to include the checked state from > this collection if > the record is modified while you move back and forth pages. > > In your submit action you want to display the checked > records, so filter and > display the records in your collection that have checked=true. > > Finally update the records in your collection to the > database. If I understand > correctly you want to update the checked state (checked and > unchecked records). > > I hope that helps. > Anuj > > > > > > > Jignesh Kapadia on 08/19/2004 01:59:03 PM > > Please respond to "Struts Users Mailing List" > > To: [EMAIL PROTECTED] > cc: (bcc: Anuj Upadhyay/Jeppesen/TMC) > > Subject: dealing with check boxes > > > > Hi , > I did post a question regarding the problem I am facing in > dealing with > check boxes in struts. I did not get a proper reply. I am > just explaining the > scenario . It will be good help from your side if somebody > can guide as how > this can be done . > > We have a previous/ Next screen scenario. we want to display 'N' > records from database on screen with 15 per screen.To go to > next 15 you have to > click on next button and so on and to come back to previous > 15 user will have to > click 'Previous' button on screen. > > Each records will have a check box which will be checked or > unchecked initially > depending on the boolean value of one column in the record. > User can change > that by checking and unchecking check box infront of each record.. > > The stage I am stuck is . say when I check/uncheck checkbox > for records on > first page and click 'Next' button. I am shown next 15 > records. I do the same > thing on second page. But when I click 'Previous' button to > come back to first > page my previous changes are lost. > > Also when I click 'Submit' (This is an additional button on > screen other then > 'Previous' and 'Next' button) button on screen. It should > show me all the > selected records on next screen which will be updated in > database with the > changed boolen value of the column. > > "time screen is refreshed. > > I also tried using capture the changes in this case > > Thanks and your help wil be really appreciated, > Jignesh > > > --------------------------------- > Do you Yahoo!? > Win 1 of 4,000 free domain names from Yahoo! Enter now. > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------- > Do you Yahoo!? > Yahoo! Mail - 50x more storage than other providers! > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------- Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now.