Re: Passing URL parameters to component via direct action
Re: Passing URL parameters to component via direct action
- Subject: Re: Passing URL parameters to component via direct action
- From: John Pollard <email@hidden>
- Date: Mon, 11 Aug 2008 22:53:14 +0100
Bill,
On 11 Aug 2008, at 20:14, William Hatch wrote:
Hi John,
It sounds like you want to call a DA, then return the same page you
were on when calling the DA, and have the page contain the same
values it had before you called the DA. Correct?
No, I want it to accept the WOPopUpButton selections made by the
person viewing the web page. I don't need it to remember anything
about the state it had before. The same page yes, but not the same
values it had before.
If so, you can just pass all of the values you need to the da as
request parameters, outlined previously, and then make sure your
component can set them with either standard getters and setters or
using KVC.
I want the values to be set within a WOForm within my page. The values
are passed fine to the DA. I could take them out of the request myself
and work out how to set the WOPopUpButton selected values in the form.
But what I'm after is a way for the WOForm to take the values from the
request, the DA request without me having to do it. After all, the
values are in the URL, so why should I parse them to take them out and
set the WOPopUpButton states when I'm guessing WO can do it for me?
Sorry I haven't read those DA articles etc. but I will do.
Thanks,
John
Any other things required to render should be able to be derived
from what you're setting up in the component during the DA.
Bill
On Aug 11, 2008, at 12:29 PM, John Pollard wrote:
Lachlan,
On 11 Aug 2008, at 13:29, Lachlan Deck wrote:
On 11/08/2008, at 10:10 PM, John Pollard wrote:
I have a page containing a WOForm with some dynamically created
WOPopUpButtons. The WOForm is set to submit a Direct Action
request (using get as opposed to post).
The request received by the DA method contains information from a
couple of hidden fields in the form which allows me to construct
and configure the right page which is actually just a new
instance of the same page.
Is there a really simple way to get the WOPopUpButton values from
the request DA URL into the WOForm as if the WOForm had been
submitted with those values as a component action?
public String getSomeSelectedValue()
{
if ( someSelectedValue == null )
someSelectedValue =
context().request().stringFormValueForKey( "someSelectedValue" );
return someSelectedValue;
}
Yes, that's fine, I can get a named value no problem. But here I am
referring to an array of dynamically generated named values that
make up a WOForm content. My feeling is that I shouldn't need to
pick out the values, the WOForm should be able to take them from
the request, even if the request comes via a DA.
I tried calling takeValuesFromRequest(request(), context()) from
my DA method but that produced a NPE. Perhaps this method can't
work from a DA request/context?
What's the stack trace?
I expect the above call makes no sense anyway, it was a long shot.
However, if someone says this should work, I'll give a stack trace.
Obviously I can parse the DA request, dig out the WOPopUpButton
selections and pass them to the page myself and set the popup
selections, but it strikes me that there ought to be an easy way.
There's lots of ways to do things.
I'm just looking for the lazy man's way that will save me picking
out values now and in the future when I need to do similar again.
I will look at David LeBer's articles and podcasts as advised by
Ramsey and see if that helps.
Thanks,
John
_______________________________________________
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
_______________________________________________
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