Re: WOPopup doesn't display the selection attribute
Re: WOPopup doesn't display the selection attribute
- Subject: Re: WOPopup doesn't display the selection attribute
- From: Chuck Hill <email@hidden>
- Date: Wed, 6 Feb 2008 14:33:31 -0800
On Feb 6, 2008, at 2:26 PM, Bjerke, Michael A. wrote:
I have an application with a page that contains some text boxes
(WOTextField) and some popups (WOPopup). Normally this page is
brought up with nothing filled in by creating a new (empty) object
of the class Entry, but I can also bring it up by setting the Entry
object to one from my database. The WOTextFields display correctly
because they are bound to particular fields in the Entry object,
e.g. entry.title. The popups, however, never display the entryType
value in the Entry object. Here are the bindings for one of the
popups.
displayString entryTypeItem.name
item
entryTypeItem This is an EntryType object
list
availableEntryTypes This is a list of EntryType objects
noSelectionString “None”
selection
entry.entryType entry is an Entry object;
entry.entryType is an EntryType object
Now, I understand that when the user chooses a value in the popup,
that value gets stored in the entryType field of the Entry object,
because of the selection binding. But what I have is the entryType
already set. I expected the popup to show that entry, but it
always shows the top entry in the list, None, as selected. I tried
using the selectedValue attribute instead, but that made no
difference. I turned WODebug on for this popup and the log entries
show that the selection attribute has the correct EntryType.
The EntryType class has a name field, and that’s what is displayed
in the popup. But how is the system supposed to know how to
compare the selection attribute’s value with each of the EntryTypes
in the list? Does it just do something like entry.entryType.equals
(entryTypeItem)? If I replace all references to EntryType with
just Strings, this works OK, but I’s rather have the EbtryTypes in
there.
Can you tell me how I am supposed to pre-populate the popups?
It works if the selection and the objects on list are equals(). Is
EntryType an EO? If so, availableEntryTypes and entry have to be in
the same editing context for them to be equals().
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden