Select to view content in your preferred language

Address Locator in Locate Widget

5001
30
09-29-2010 05:30 AM
StuartBlumberg
Emerging Contributor
Hello,

I am using the sample flexviewer 1.3. I have created an address locator in ArcCatalog 10 and created a geocoding service in Server. I want to use this geocode service in the locate widget, however when I try there are three text boxes with a dropdown box for the state. I need there to be just one text box for the address and a submit button. When I try using an address locator that I created in 9.3.1 it works fine, it must be an issue with 10? Thanks.
Tags (2)
0 Kudos
30 Replies
StuartBlumberg
Emerging Contributor
Bjorn,

I can't remember now if I am using a custom locate widget, its been well over a year now.  There must be something in my code conflicting with the 10 address locator.  I'll work with it a little more and see what I can come up with.  Thank you.
0 Kudos
StuartBlumberg
Emerging Contributor
Bjorn,

I am using this locate widget for a small local government (pop. 31,000), so there is no need for anyone to input anything but the street address.  Do you have any suggestions on what I can do in my situation?  Thanks.
0 Kudos
MarcWeinshenker1
Regular Contributor
I believe I'm doing the same thing -- just a single line to enter a street address with no need for city/state/zip and a street address locator.  To do this I started at the configuration XML for the locator widget (LocateWidget_US.xml is one that comes with Flex Viewer 2.1) and deleted the <listfield> and <listvalues> tags.  The extra form boxes went away.  Hope this is what you are looking for.

Marc
0 Kudos
StuartBlumberg
Emerging Contributor
Marc,

I remember deleting those tags when I was using the 9.3 address locators and it worked fine.  However now that I'm using a 10 locator it doesnt work anymore.  At the moment I can't upgrade to the new 2.1 API.  I may just create the locator on a 9.3 machine and use that.  Thanks.
0 Kudos
MarcWeinshenker1
Regular Contributor
Stuart,

I haven't moved to ArcGIS 10 yet, but it looks like I should be prepared for problems.

Marc
0 Kudos
StuartBlumberg
Emerging Contributor
Indeed, Marc, indeed........ 🙂
0 Kudos
SandeepTalasila
Occasional Contributor
Hi,
Is there a way to set default values for the state text box in the address locator widget. I do not want the combo box with all states, instead i need a text box with a default state name in it.
I have deleted the list field in tag the locatewidget_us.xml file to remove the combo box and made a text box, but how to set the default value?
Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Sandeep,

   You would have to do this in the mxml code and specify an if statement to insert the state name when it is building the form items.
0 Kudos
SandeepTalasila
Occasional Contributor
Hi Robert,
Thanks for the response. I understood what you said, but I am not quiet sure how to change it. And the text box should not allow to enter any other state name. I want to restrict the widget to one state.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Sandeep,

   In the onJSONLoad function replace this

// loop through the shown fields to create form items
                    for (var i:Number = 0; i < shownAddressFields.length; i++)
                    {
                        var frmItem:FormItem = new FormItem();
                        frmItem.percentWidth = 100;
                        frmItem.label = shownAddressFields.name + ": ";

                        if (shownAddressFields.name != listField)
                        {
                            if(shownAddressFields.name == "State")
                            {
                                var lblItem:Label = new Label();
                                lblItem.percentWidth = 100;
                                lblItem.id=shownAddressFields.name;
                                lblItem.text = "Alabama";
                                frmItem.addChild(lblItem);
                                addrObjects.push({ item: lblItem, required: false });
                            }else{
                                var txtItem:TextInput = new TextInput();
                                txtItem.percentWidth = 100;
                                txtItem.removeEventListener(FlexEvent.ENTER, addressTextItemEnterHandler);
                                txtItem.addEventListener(FlexEvent.ENTER, addressTextItemEnterHandler);
                                txtItem.id = shownAddressFields.name;
    
                                // required field
                                frmItem.required = shownAddressFields.required;
                                frmItem.addChild(txtItem);
    
                                addrObjects.push({ item: txtItem, required: shownAddressFields.required });
                            }
                        }
                        else
                        {
                            var cboItem:ComboBox = new ComboBox();
                            cboItem.id = shownAddressFields.name;
                            cboItem.dataProvider = listArray;

                            // required field
                            frmItem.required = shownAddressFields.required;
                            frmItem.addChild(cboItem);

                            addrObjects.push({ item: cboItem, required: shownAddressFields.required });
                        }
                        frmLocateAddress.addChildAt(frmItem, i);
                    }
0 Kudos