Select to view content in your preferred language

Clear Single line search on click code

2014
4
02-26-2013 02:35 PM
RhettZufelt
MVP Notable Contributor
Hi All,

Users getting frustrated with the single line search, after selecting something from the dropdown, it populates the search box with the entire string selected.

Often need to select some of it, delete, select more, delete, and so (even double/triple click doesn't work) on just to clear the box to enter a "new" search term.

Anyway, This is what I did to the SearchInputSkin.mxml to make it clear the text each time the user clicks in the search box.

In case someone else wants this:

            <s:RichEditableText id="textDisplay"
                                verticalAlign="middle"
                                widthInChars="10"
           click="textDisplay.text=''" />


R_
Tags (2)
0 Kudos
4 Replies
BjornSvensson
Esri Regular Contributor
Hi Rhett,
Users getting frustrated with the single line search, after selecting something from the dropdown, it populates the search box with the entire string selected.


Just curious - the current behavior is the same as when searching Google, Bing or Yahoo. Once a user selects an item, it will populate the search box, then user can click in the search box to modify as well as double-click to select a word. Are these users frustrated with those search boxes as well?

Often need to select some of it, delete, select more, delete, and so (even double/triple click doesn't work) on just to clear the box to enter a "new" search term.


What part isn't working?
I know that with the default black-gold colors of the flex viewer it is hard to see the word highlighted when double-clicking, but otherwise I think the current implementation is a good default (except for the hard-to-see visual distinction when selected).  Try for example the lighter colored samples:
http://resources.arcgis.com/en/help/flex-viewer/live/index.html?config=apps/config-css-desert.xml
http://resources.arcgis.com/en/help/flex-viewer/live/index.html?config=apps/config-css-sage.xml

Of course, if someone really wants to change this behavior, they could use your code 🙂
0 Kudos
RhettZufelt
MVP Notable Contributor
Bjorn,

If it were to work like Google or Bing, then it would be great, but it only partly behaves that way.

If I do a search, it will populate the dropdown list with the results that "contain" my search string.  If I pick one that the search string is not the very first item, it will populate the box with all the values from all the configured search fields for that feature.

I can then double click to select it, but it will only select a single word.  If I have 5 search fields, then I have to either  double click many times (as the double click select doesn't span any puctuation, spaces, commas, etc) and delete them, or drag/select the entire string if I want to delete and do a new search.  Since some of my fields may have a sentence in there, not just a single word, this is tedious as I have to keep dragging off the viewer until I reach the end of the string.

So, this is similar to Google (of course the Google search box isn't a tiny little box in the corner, and can normally see the "entire" search string) except with Google, if I want to clear the entire string for a new search, then tripple click is the answer (most software, double click selects a word, tripple click selects entire line).  If this box had a tripple click/select all like Google, Bing, and Yahoo, and the rest of the world, then it would be a moot point.

Of course, a simple clear button would resolve the issue as well.
There just isn't a "non-frustrating" way to clear a large string from that box when one wants to do a new search.

I'm pretty new to flex and not sure how to add the tripple click option, and had issues trying to get a clear button to show up "outside" of the textinputbox, so I handled it this way.



R_
0 Kudos
GISDev1
Deactivated User
Just wanted to chime in and say I agree 100% with Rhett's reply above.
The Single Line Search in the top right corner is close to being good, but not quite. The user interaction is quite cumbersome for the exact reasons Rhett mentions.
0 Kudos
BjornSvensson
Esri Regular Contributor
Triple-click is a good suggestion - thank you 🙂

Meanwhile, what I've been using is Ctrl-A, which also selects the whole text.

Note also that the full text is selected when you use the keyboard to Tab out of it and then Shift-Tab back in.
0 Kudos