Re: WODisplayGroup, WORepetition and selection of displayed items using checkbox.
Re: WODisplayGroup, WORepetition and selection of displayed items using checkbox.
- Subject: Re: WODisplayGroup, WORepetition and selection of displayed items using checkbox.
- From: Robert Walker <email@hidden>
- Date: Tue, 23 Dec 2003 21:34:18 -0500
First a question:
What is the checkbox's binding? Is it bound to an attribute of the EO?
Is it bound to an instance variable? Or something else? The point
here is that something must store the value of the checkbox as related
to the current object of your repetition. A typical use of the
checkbox is to connect the "checked" binding to a "Boolean" attribute
of an EO.
It's my opinion that you should rethink your user interface. Maybe
someone else out there has figured out a way to use checkboxes in this
manner, but I have not.
The explanation of your problem sound very much like the
"shopping-cart" design pattern where the user selects items they wish
to purchase then they move on to the "check-out" page. May not be
exactly this, but the process sounds similar.
In any case you must have a mechanism that stores the user's
selections. Checkboxes have no persistent storage on their own. So a
checkbox showing up "checked" on the page doesn't mean it's storing a
value anywhere. Also there doesn't seem to be any relationship between
your checkboxes and the objects that you wish to have selected. Just
putting a checkbox in the repetition doesn't provide any correlation to
the current object of the repetition, unless the checkbox is bound to
an attribute of the current object.
Here is one possible solution to this problem. Instead of using
checkboxes, use a hyperlink (or image hyperlink) that is bound to an
action method that adds the selected object to an array of selected
objects. This will cause the page to be refreshed on each selection,
but this is the only way WebObjects will know which line of the
repetition was selected and it gives WebObjects an opportunity to store
the selection.
In order to indicate selected items you can use a method that checks to
see if the current object of the repetition is contained in the
"selections" array and return a "selected" form of your hyperlink (i.e.
a different image or different text string).
You will probably also need an action to remove the object from the
selections array as well.
Hope this helps. I'll be curious to know if someone else has a better
solution.
On Dec 23, 2003, at 8:49 AM, David WO wrote:
Hi,
I am displaying list of objects using a
WODisplaygroup, and WORepetition. The user will select
some items from first page, then move on to next page
and select some and so on using check boxes.
The problem is when the use selects a previous page,
his selection is gone. How to implement this. I want
the user's earlier selection still checked when he
traverses to a previous page, so that when he presses
a button such as "select checked items" all his
selection from multiple pages is stored.
Is there any code sample of a small app available to
show how to accomplish this.
Thanks.
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Sincerely,
Robert Walker
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.