Re: Posting vars programatically from component to Direct Action
Re: Posting vars programatically from component to Direct Action
- Subject: Re: Posting vars programatically from component to Direct Action
- From: Randall Perry <email@hidden>
- Date: Sat, 17 Apr 2004 08:49:44 -0400
> Ah, well, there are lots of different ways to do that. Your technique
> is a new
> one to me (clever!). You can always do the typical thing of creating a
> variable
> (public or with appropriate setters/getters) and doing
> WOComponent nextPage = pageWithName("theNextPage");
> nextPage.takeValueForKey(val, "variableName");
>
Will this work when passing vars to a Direct Action? Does WO consider DA's a
'page'.
> You could go right ahead and use a WOHiddenField.
Ok. Should've checked for that. May be the most straightforward way to do
it. My purpose is to prevent the user from seeing the info.
> You could store data
> into the
> WORequest or the WOResponse using takeValueForKey (they're both
> subclasses of WOMessage
Yeah, what I was looking for was how to append form vars to a response so
they can be picked up by request in the receiving DA.
> which supports that API), you could store things in session temporarily
> using setObjectForKey,
> from within the constructor for a WOComponent you could do
> context().page().valueForKey("variableName");
> to pull the values from the calling page, you could create a binding on
> the component
> and bind the values from one component to the other.
>
> Normally, the first thing I described above is what people do. Do you
> have any particular
> objective besides getting a value from one component to another?
> ----
> WO in philadelphia - wanna cheesesteak with that?
> Please visit webobjects.meetup.com.
>
> On Apr 16, 2004, at 11:38 PM, Randall Perry wrote:
>
>> I can post form vars from one component to another (or to a Direct
>> Action)
>> by simply naming bound form fields.
>>
>> So if I have a textbox that's bound to userName and I also set the name
>> property of the textbox to "userName" I can grab the key/value pair
>> from the
>> succeeding page from the request using
>> request().formValueForKey("userName")
>> because WO 'posts' the vars from form elements to the next page.
>>
>> So, I'm wondering how to do the same thing in java, without having an
>> actual
>> bound textbox on the page. It's the same idea as having an input of
>> type
>> 'hidden' in an HTML form.
>
--
Randall Perry
sysTame
Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales
http://www.systame.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.