• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: takeValueFromRequest phase
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: takeValueFromRequest phase


  • Subject: Re: takeValueFromRequest phase
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 30 Jul 2007 23:20:20 -0700

Nooooooooooooo. :-) Maybe some more detail on what you are doing would help. These are WOComponent subclasses? Stateless? Stateful? What else do they do?


Chuck


On Jul 30, 2007, at 11:17 PM, Lachlan Deck wrote:

Hi again,

I've stripped back the components involved and still no dice. Ugh.

Perhaps somehow I'm being bitten by WOComponent structure stuff. Don't know.
http://en.wikibooks.org/wiki/Programming:WebObjects/ Web_Applications/Development/General_Best_Practices


Anyway, this seems to be getting me somewhere...
1) bind checkbox's name attribute to a unique key in the child component.
2) parent keeps a list of child components that need updating during takeValuesFromRequest
3) child registers itself after appendToResponse.


// --- parent ---
private NSMutableDictionary childComponents;
public void appendToResponse( WOResponse aResponse, WOContext aContext ) {
childComponents = new NSMutableDictionary();
super.appendToResponse( aResponse, aContext );
}
public void takeValuesFromRequest( WORequest aRequest, WOContext aContext ) {
super.takeValuesFromRequest( aRequest, aContext );
for ( Enumeration en = childComponents.allValues().objectEnumerator (); en.hasMoreElements(); ) {
WOComponent element = ( WOComponent )en.nextElement();
element.takeValuesFromRequest( aRequest, aContext );
}
}
// --- child ---
public void appendToResponse( WOResponse aResponse, WOContext aContext ) {
super.appendToResponse( aResponse, aContext );
( ( Parent )parent() ).childComponents().setObjectForKey( this, context().elementID() );
}
public void takeValuesFromRequest( WORequest aRequest, WOContext aContext ) {
super.takeValuesFromRequest( aRequest, aContext );
setIsSelected( aRequest.formValueForKey( uniqueKey() ) != null );
}


On 31/07/2007, at 12:47 PM, Chuck Hill wrote:

On Jul 30, 2007, at 7:43 PM, Lachlan Deck wrote:

On 31/07/2007, at 12:31 PM, Chuck Hill wrote:

On Jul 30, 2007, at 7:21 PM, Lachlan Deck wrote:

On 31/07/2007, at 11:47 AM, Chuck Hill wrote:

Perhaps the bottom of http://www.stepwise.com/Articles/ Technical/WOF_Checkboxes.html
Note the year. :-)

Hmm... interesting. Thanks for pointing that out. But I don't think that's it.


Check and see what is going back to the server in terms of form values when you submit the form. The fix, IIRC, is to put a dummy hidden field in the form so that WO processes takeValues.

The strange thing is that in a dummy test app I've just made, it too only has checkboxes in the form but even if I make no changes to the form the child component still has its setter methods called during the takeValuesFromRequest phase. But in my app-proper it's being skipped.


I've tried putting in the hidden field, but that didn't help - so something else is skewed :-/

I'll try turning on DebugGroupComponents, DebugGroupRequestHandling...

Any other suggestions?

What do you see for form values?

{0.7.3.0.0.1.9 = ("2007-07-31 02:32:18 Etc/GMT"); 0.7.3.0.0.1.13 = ("Continue"); 0.7.3.0.0.1.5.0.1.0.0.0.23.1.0.0.1.0.3.1 = ("0.7.3.0.0.1.5.0.1.0.0.0.23.1.0.0.1.0.3.1"); }


The first is a hidden field string, second is the button, the last is the value of the single checkbox (if ticked) otherwise if not ticked it's not included.

That all looks good.


Forget to call super.takeValues someplace?

Not that I can see. But I might need to strip things (in terms of component hierarchy to see what's happening).

A missing call to super is all that I can think of. That or something in your component is messing with the element ID so it does not match up to the right object on the way back in.

On Jul 30, 2007, at 6:05 PM, Lachlan Deck wrote:

okay this is a little weird, from my understanding of WO...

I have a page with a form and in the form is a repetition of a sub-component which has a checkbox and associated logic with that checkbox.

So something like this:
<page>
	<webobject name="Form">
		<webobject name="ListItem"/> <!-- has a checkbox -->
	</webobject>
</page>

However, when ticking or unticking the checkbox in any of the ListItem components (where I've bound checked = isSelected) I'm finding that setIsSelected is not being fired in the subcomponent.

Any ideas?

with regards, --

Lachlan Deck





--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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


  • Follow-Ups:
    • Re: takeValueFromRequest phase
      • From: Lachlan Deck <email@hidden>
References: 
 >takeValueFromRequest phase (From: Lachlan Deck <email@hidden>)
 >Re: takeValueFromRequest phase (From: Chuck Hill <email@hidden>)
 >Re: takeValueFromRequest phase (From: Lachlan Deck <email@hidden>)
 >Re: takeValueFromRequest phase (From: Chuck Hill <email@hidden>)
 >Re: takeValueFromRequest phase (From: Lachlan Deck <email@hidden>)
 >Re: takeValueFromRequest phase (From: Chuck Hill <email@hidden>)
 >Re: takeValueFromRequest phase (From: Lachlan Deck <email@hidden>)

  • Prev by Date: Re: takeValueFromRequest phase
  • Next by Date: WODisplayGroup and checkboxes
  • Previous by thread: Re: takeValueFromRequest phase
  • Next by thread: Re: takeValueFromRequest phase
  • Index(es):
    • Date
    • Thread