invokeAction Question
invokeAction Question
- Subject: invokeAction Question
- From: Andrew Lindesay <email@hidden>
- Date: Wed, 7 Feb 2007 09:41:01 +1300
Hello;
In general my apps are wrapped in a switch component so many
invokeActions are finally returning 'null' to get back to the same
"page-wrapper", but (possibly for the first time in a long while) I
am trying to get one of my re-usable components to fire an action,
the result of which is non-null and this seems to be causing me an
issue which I don't _entirely_ understand.
The component in question is a java-script pop-up component which
works like WOPopUpButton except that it 'fires an action' when
somebody changes the selection. To do this, I make a hidden field
called by the name of the elementID and populate it with "YES" using
java-script when the pop-up is changed. Here is the invokeAction
(...) method from this custom component...
public WOActionResults invokeAction(WORequest request, WOContext
context)
{
String elementId = context.elementID();
String elementIdFV = (String) request.formValueForKey(elementId);
if(LEStringHelper.booleanForString(elementIdFV))
{
if(!hasBinding("action"))
throw new LEError("missing binding 'action' on a javascript
popup button.");
WOActionResults ar = (WOActionResults) valueForBinding("action");
if(null!=ar)
return ar;
}
return super.invokeAction(request,context);
}
This mechanism is working 100% except that I am somehow loosing the
returned value from this method further up the component heirachy.
The problem is that elements/components that encapsulate this one
(where I have not overidden invokeAction(...)) are then appearing to
ignore this non-null value and are instead sending back the top-level
(page) element instead as if this method had returned null.
My understanding was that an element will descend the component tree
during the invokeAction phase, invoking invokeAction(...) on all
elements until it gets a non-null value. Upon getting a non-null
value it will return it up the chain and if the top-level (page)
element gets back a null value then it will render itself. Is that
not correct?
cheers.
___
Andrew Lindesay
www.lindesay.co.nz
_______________________________________________
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