• 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: DirectAction: NSDictionary of the form values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DirectAction: NSDictionary of the form values


  • Subject: Re: DirectAction: NSDictionary of the form values
  • From: "Jerry W. Walker" <email@hidden>
  • Date: Thu, 5 Jul 2007 09:26:17 -0400

Hi, Edgar,

The NSDictionary that you receive from request().formValues() contains NSArray values for each key. WO must presume that the values returned are arrays of values, because some form elements can return an array of values and WO has no way of determining whether a given form value should be an array or not, so it opts for the more general case, presuming that they should all be arrays, and returns single valued arrays for the cases that only a single value is returned for a given key.

Given that information, you could use request().formValueKeys() to get the list of keys present and iterate through all the keys using request().formValueForKey(key) to unwrap the array around each given value to build out your own NSMutableDictionary to pass to the EOUtilities.objectsMatchingValues method. Such as:

...
NSArray myResults = EOUtilities.objectsMatchingValues (unwrappedFormValues());
...
private NSDictionary unwrappedFormValues()
{
NSArray keys = request().formValueKeys();
NSMutableDictionary results = new NSMutableDictionary(keys.count());


	Enumeration e = keys.objectEnumerator();
	while (e.hasMoreElements()) {
		NSArray theValueArray = request().formValueForKey(key);
		results.setObjectForKey(theValueArray.lastObject(), key);
	}
	return results.immutableClone();
}

Regards,
Jerry

On Jul 5, 2007, at 6:33 AM, Edgar Ra. Klein wrote:

Hi guys,

I'm having a problem w/ the Dictionary returned by the DirectAction's form values. More precisely, I have a DirectAction w/ some form values like:
...DirectAction.woa/wa/default?key1=value1&key2=value2


The method request().formValues() returns an NSDictionary looking like that:
{key1 = ("value1"); key2 = ("value2"); }


Unfortunately, the values are wrapped into (" ") and therefore I cannot pass this dictionary to ask the EOUtilities.objectsMatchingValues method for database entries.

Am I doing s.th. wrong or is there an easy way to convert the wrapped values to unwrapped versions?

Thanx,
Edgar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden


--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems


    email@hidden
    203 278-4085        office



_______________________________________________
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: DirectAction: NSDictionary of the form values
      • From: "Edgar Ra. Klein" <email@hidden>
    • Re: DirectAction: NSDictionary of the form values
      • From: David LeBer <email@hidden>
References: 
 >DirectAction: NSDictionary of the form values (From: "Edgar Ra. Klein" <email@hidden>)

  • Prev by Date: Re: WOBuilder Replacement
  • Next by Date: Re: DirectAction: NSDictionary of the form values
  • Previous by thread: DirectAction: NSDictionary of the form values
  • Next by thread: Re: DirectAction: NSDictionary of the form values
  • Index(es):
    • Date
    • Thread