Ah ha.  I think I just understood the real problem; each subsequent submission of the form wipes out the current collection of selected checkboxes.  If that's your problem, then I believe you're going to have to modify the way you're modelling the collection of as well as the behavior of the accessor/mutator.  In Teds example, the Multibox is backed by a String[], however, you're probably going to have to back it with a Collection, allowing you to grow/shrink as your user selects/deselects.

Dennis




Dennis Graham/EvergreenFunds

06/16/2004 04:22 PM

To
"Struts Users Mailing List" <[EMAIL PROTECTED]>
cc
Subject
Re: Resultsets and multi-check formsLink




Sounds like you're describing a struts Multibox:
http://jakarta.apache.org/struts/userGuide/struts-html.html#multibox

Ted Husted has a nice intro here:
http://www.jguru.com/faq/view.jsp?EID=925277

Dennis
 


"Chris Cranford" <[EMAIL PROTECTED]>

06/16/2004 04:06 PM

Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>

To
"Struts Users Mailing List" <[EMAIL PROTECTED]>
cc
Subject
Re: Resultsets and multi-check forms





Sort-of Yes.

We never really "persist" what is selected to any layer beyond the form because we're only gathering attributes that which are provided to our "search" action once all the selectable attributes.

So from a technical use-case perspective I understand that:

1. Form session scoped for simplicity with collection of record_ids (initially empty)
2. Go to database to get records (!-10) since page requested is initially 1
3. Skip preselection step since record_ids collection.size() == 0
4. Render Form

5. User selects items 1 and 3 and submits form via next page link
6. Since record_ids collection size() == 0, populate collection with selections 1 and 3.
7. Go to database to get records (11-20) since page requested is 2
8. Loop through collection to preselect -- again nothing done here
9. Render Form

10. User selects 15 and submits via next page link.

Here is where I get tripped up because in this case I would just need to add 15 to the selection array in my form, but technically it is possible then that once they view results 21-30, hit prev page I should show 15 as selected.  If they unselect 15 and either dont select anything or select another record, how do I track this?

Maybe I'm creating my form incorrectly using the wrong type of tag to manage my selection list/boxes.  Sorry, just been up too long without sleep and this is probably something very trivial that I'm overlooking.

Thanks in advance!
 ----- Original Message -----
 From: [EMAIL PROTECTED]
 To: Struts Users Mailing List
 Sent: Wednesday, June 16, 2004 3:42 PM
 Subject: Re: Resultsets and multi-check forms



 You might want to re-present the problem.  When I read your email, it seemed like you were describing a typical use-case:

 1. Get data from a persistent store
 2. Populate form.  If attribute indicates "selected", preselect checkbox
 3. Render form (allowing user to edit)
 4. Persist edits.

 Dennis



       "Chris Cranford" <[EMAIL PROTECTED]>
       06/16/2004 03:35 PM Please respond to
             "Struts Users Mailing List" <[EMAIL PROTECTED]>


      To <[EMAIL PROTECTED]>  
             cc  
             Subject Re: Resultsets and multi-check forms

             

     



 I haven't seen any comments on this .. any ideas?

 > To broaden the prior discussion on resultset caching, I'd like to also
 ping
 > the group on the concept of being able to have this "resultset" of data
 and
 > paging through it but extendeding it to where a checkbox exists for each
 > viewable record.  I need to be able to pre-select values from a database
 > ahead of time based on past settings and permit them to page through the
 > resultset setting all their new values to finally accepting those and
 > writing them back to the database when the user hits the "Save" button.




 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





------------------------------------------------------------------------------


 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to