Set focus to and select text in input field

Set focus to and select text in input field

  

Hi, I use the input_SetFocus widget to set the cursor in the SearchInput field together with an onfocus extended property to select the text already present in the input field. This works fine.

I wonder ... does OutSystems provide a more simple way (one statement or so) to achieve the same result?


Hi Charles, 

Not really, but you can easily create a web block that encapsulates that functionality so that you don't have to repeat it over and over.


Cheers,

Tiago.

Charles Betman wrote:

Hi, I use the input_SetFocus widget to set the cursor in the SearchInput field together with an onfocus extended property to select the text already present in the input field. This works fine.

I wonder ... does OutSystems provide a more simple way (one statement or so) to achieve the same result?




Or Create an action with this Javascript:

(Call action RunJavaScript from HTTPRequestHandler Extension)

Input Param is your textbox


"osjs('#" + WidgetId + "').focus();"+ "osjs('#" + WidgetId + "').select();"