Select to view content in your preferred language

New geocoder component and intersection searches with "/"

844
0
06-07-2013 07:41 AM
DaveEaton
Emerging Contributor
I need to use a fore slash for intersection searches, which do not seem to be supported so I am working around it with a regular expression search and replace to use an intersection connector that I know will work.  Below is the code that I am using, when the user hits the enter key the regular expression function runs, and replaces the / with &.  That result is assigned to a bindable variable which is used by the Geocoder.  When I run this in debug mode, everything works...the variable shows the / intersection search has been converted to an &...however it seems that the original search that has the / is being sent to the rest endpoint.  I can find no reference to the search text that includes that /...so I'm not sure how it is being sent.  What am I missing here?

   public function searchPattern():void {

    var pattern:RegExp = /(\)/g;
    var pattern1:RegExp = /(\/)/g;

    if (geocoder.text.search(pattern) > -1){
     geocoder.text = geocoder.text.replace(pattern, " & ");
     geotxt = geocoder.text;
     return;
     }

    if (geocoder.text.search(pattern1) > -1){
     
     geocoder.text = geocoder.text.replace(pattern1, " & ");
     geotxt = geocoder.text;
     trace (geotxt);
     return;
     }
    
   }
   
 <esri:Geocoder  id="geocoder" text="{geotxt}" enter="searchPattern()" fault="geocoder_faultHandler(event)"  x="55" y="10" width="300" height="30" autoComplete="false" map="{map}"  mapServices="{mapServ}" minCharacters="2" 
       resultSelected="geocoder1_resultSelectedHandler(event)"
       url="http://{URL1}/arcgis/rest/services/compositeMay2013/GeocodeServer"
       />
Tags (2)
0 Replies