Re: performParentAction and Form Values
Re: performParentAction and Form Values
- Subject: Re: performParentAction and Form Values
- From: Peter <email@hidden>
- Date: Wed, 28 Feb 2007 19:28:43 -0500
On 2/28/07, Chuck Hill <email@hidden> wrote:
On Feb 28, 2007, at 2:39 PM, Peter wrote:
> I am using the performParentAction(String) method in my SimpleButton
> to perform the actual method. Since this is nested on the DialogBox
> which is placed on a page in my app, I have a recursive pattern to
> check the parents for the matching action, and execute if found.
Not sure what you mean, but it sounds kind of iffy. :-)
Without this recursive pattern, I am not able to perform the parent
action since the action method is not in my DialogBox.java, but on
it's parent, one of my pages say TestPage.java.
> I have looked into takeValuesForRequest but no luck getting the latest
> form values from the browser.
>
> How do I get a subcomponent to ensure that its parent's (or parent's
> parent's, etc) form value are taken before the performParentAction is
> excuted.
If a form was submitted, it should "just happen". Things to check:
I am not sure if this means that by invoking an action from within a
form, that is equivalent to submitting the form... even if the action
is being invoked from a subcomponent?
1. Are the form values in the URL / content of the request?
Maybe this is my problem. Every time I log the
context.request.formValues it is null.
2. Have you overridden takeValues... someplace and forgotten to call
super?
I checked and all takeValuesFromRequest are calling super and not overridden.
3. Can you add logging and see if takeValues is getting called on the
top level page?
I added takeValuesFromRequest (w/logging) to the top level page, to
its subcomponent (DialogBox.java) and DialogBox.java's subcomponent -
SimpleButton.java. It is not being called anywhere.
All this lead me to think that there is some other "hidden" form. I
am going to look around in the mean time.
> FYI Here is the heart of the SimpleButton.java logic for performing
> the action on page in which it is placed.
>
> // since this subcomponent may be place in another subcomponent,
> find first parent
> // that responds to the method name (actionName).
>
> public WOComponent action() {
> WOActionResults results;
> results = findAndExecuteParentAction(this,actionName());
> return (WOComponent)results;
> }
>
> public WOActionResults findAndExecuteParentAction(WOComponent
> component, String actionName) {
> WOActionResults results = null;
> try {
> component.parent().valueForKey(actionName);
> results = component.performParentAction(actionName);
I think those two lines are functionally equivalent.
Agreed. But without it, I am getting
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException which
does not get caught in my catch statement. I am java-weak :-(
> } catch (NSKeyValueCoding.UnknownKeyException e) {
> WOComponent parentComponent = component.parent();
> if (parentComponent != null) {
> results = findAndExecuteParentAction(parentComponent,
> actionName);
> }
> }
>
> return results;
> }
_______________________________________________
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