Select to view content in your preferred language

Single line address field usage in flex

804
4
01-11-2011 11:35 AM
JacksonTrappett
Frequent Contributor
Hi, I'm trying to write some code to use an address locator and I want to use the single line address field.  I have set up my address object with just the single line:

var myAddress:Object = 
 {
  SingleLineInput: searchBox.text
 };


However I can not give the address field the correct name.  According to my locator the field should be called:

"Single Line Input"

as seen in this JSON code in the locator's rest endpoint:

"singleLineAddressField" : {
    "name" : "Single Line Input", 
    "type" : "esriFieldTypeString", 
    "alias" : "Full Address", 
    "required" : false}


The problem is that Flex will not allow me to pass a field name of "Single Line Input" because it has spaces in it.  All of the other field names work fine since they have no spaces.  How can I use this field name in my flex code?

Thanks to anyone who can help,

Jackson
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Jackson,

   Normally the actual input name will not contain spaces so I would check your REST Service directory and look for address fields like I show in the attached image.
0 Kudos
JacksonTrappett
Frequent Contributor
That's where I got my field name, here's a screen-shot of that area in my service.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jackson,

   try:

var myAddress:Object = new Object();
    myAddress["Single Line Input"] = searchBox.text;
0 Kudos
JacksonTrappett
Frequent Contributor
That worked, thanks!

I just spent about 45 minutes searching for that syntax before finally posting!
0 Kudos