Select to view content in your preferred language

eSearch question: Hit enter when searching multiple attributes

811
3
Jump to solution
11-07-2012 07:14 AM
BrianFausel
Frequent Contributor
I am using the recent eSearch widget v 3.013 in the 3.0 Flex Viewer.  How challenging would it be to modify it to allow a user to hit enter (rather than click the Search button) once they fill in their search strings for two or more attributes?  I know Robert removed this capability for a reason (see link below), but I figured I would ask.  Any guidance would be greatly appreciated, especially if written for someone with limited Flex programming experience.  I have deployed the viewer and widget via the source code and have access to Flash Builder.

Thanks to Robert for the great tools he has developed and supported over the years!

Robert???s response about this request:
http://forums.arcgis.com/threads/60812-Enhanced-Search-Widget-Searching-Multiple-Fields?highlight=es...
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Brian,

   Actually after thinking about it for a minute... Here is the solution:

            /*              * when a value triggers a submit such as when Enter is pressed in text box             * perform the search             */             private function onSearchSubmitted(evt:Event):void             {                             if(searchGroup.numElements == 1){                     equeryFeaturesText(null);                 }else{                     //If the search is valid then the searchBtn is enabled                     if(searchBtn.enabled){                         equeryFeaturesText(null);                     };                 };             }

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Brian,

   I can point you to where you would insert code that verifies that the inputs are valid and then does the search:

            /* 
            * when a value triggers a submit such as when Enter is pressed in text box
            * perform the search
            */
            private function onSearchSubmitted(evt:Event):void
            {
                // TODO: validate here?
                
                // if single value, then automatically submit
                // TODO: if >1 value and all are valid, then submit
                if(searchGroup.numElements == 1){
                    equeryFeaturesText(null);
                };
            }
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Brian,

   Actually after thinking about it for a minute... Here is the solution:

            /*              * when a value triggers a submit such as when Enter is pressed in text box             * perform the search             */             private function onSearchSubmitted(evt:Event):void             {                             if(searchGroup.numElements == 1){                     equeryFeaturesText(null);                 }else{                     //If the search is valid then the searchBtn is enabled                     if(searchBtn.enabled){                         equeryFeaturesText(null);                     };                 };             }
0 Kudos
BrianFausel
Frequent Contributor
That did the trick, thanks for the quick response!
0 Kudos