Page 1 of 1

Textbox value selection when widget gains focus

Posted: Mon Oct 12, 2020 1:40 pm
by BFoster
I have a user requirement to allow selection of a field value to occur when the user clicks on the textbox widget.

I found this link that refers to two solutions. (See below) The first is the server-level solution (http://www.profoundlogic.com/docs/displ ... t+on+Focus) which would affect all fields on all applications and the second solution refers to "this.focus()" which would be a discrete field sort of solution. This did not work for me either.

Is the server-level solution (http://www.profoundlogic.com/docs/displ ... t+on+Focus) the only way to get the field value selected when the textbox widget gains focus? The goal here is to get the value selected for one field only as opposed to the server-level configuration that affects all fields.

The original post : https://core.profoundlogic.com/forum/vi ... ome#p10997

Re: Textbox value selection when widget gains focus

Posted: Mon Oct 12, 2020 1:55 pm
by Scott Klement
Hi BFoster,

I'm not sure that I understand. You say that:
  • You can't use the "Highlight on Focus" feature because it affects all fields.
  • You can't use this.focus() because it affects only one field. But, then you say you want it for one field only.
Under what circumstance do you want it to be highlighted?

Also, I think the second option should be "this.select()" running in the "onfocus" event. That was probably a typo in the earlier thread.

Re: Textbox value selection when widget gains focus

Posted: Mon Oct 12, 2020 2:57 pm
by BFoster
The goal here is to get the value selected (getting highlighted in the process) for only one field as opposed to the server-level configuration that affects all fields and all applications.

The user simply wants to start typing over the existing value in the textbox after the widget gains focus. We would like to accomplish this without affecting all textboxes in all applications (via server-level config). We prefer to affect a single field on a particular screen.

Re: Textbox value selection when widget gains focus

Posted: Tue Oct 13, 2020 2:16 pm
by Scott Klement
Set the text box's "onfocus" property to

Code: Select all

this.select();
If that won't work, then please explain better.