call a ComponentAction from a select's onchange

Zak Burke <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
This following explanation gets kinda complicated, but I think it's
pretty simple. I have a lits of links for updating different aspects of
an EO. I want to replace the list of links with a select-list; when the
list selection changes, a new window should open with the requested page
loaded. How do I do this when "requested page" is a component action?

OK, that's the short explanation. Here's the long one:

I have page like the following:

EO 1: <action 1> | <action 2> | <action 3>
EO 2: <action 1> | <action 2> | <action 3>
EO 3: <action 1> | <action 2> | <action 3>

Where the <action> items are JSModalWindows with their action bindings
bound to methods that return WOComponents. These actions are
proliferating and I'd like to replace this list of links with something
like a WOPopupButton so that I get code that renders sorta like the
following:

<select onchange="window.open(this.options[this.selectedIndex].value);">
<option value="...MyApp.woa/wo/4.0.1.6">action 1</option>
<option value="...MyApp.woa/wo/4.0.1.7">action 2</option>
<option value="...MyApp.woa/wo/4.0.1.8">action 3</option>
</select>

I know how to do this with DirectActions, but I can't figure out how to
do it with ComponentActions.

Here is the approach I've taken so far:

A non-synchronizing WOComponent [SelectPopup] pulls an NSArray [actions]
of WOComponents (returned from the action1, action2, etc. bindings) from
its parent. It sets up a WOGenericContainer as a <select> item and
iterates over actions, pushing each to a non-synchronizing WOComponent
[SelectPopupItem] with an "item" binding. SelectPopupItem uses a
WOGenericContainer to create an <option> and pulls its "value" attribute
from the "item" binding, like this:

valueForBinding("item").context().componentActionURL();

The component action URLs thus generated are all unique, but
unfortunately, they all seem to refer to the same page. Instead of
returning the WOComponent from SelectPopup.actions, the original page is
returned.

Am I on the right track? I feel like I'm working a bit too hard on what
seems like a simple problem, but I found no pointers to simple solutions.

TIA,

zak.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.