What is a solution to do select all of the contents of a textfield when the texfield receives focus? Example, if i click on the browser's address bar, the contents of the address bar will selected.

asked 08 Dec '13, 23:37

Ecky%20Danafialy's gravatar image

Ecky Danafialy
213
accept rate: 0%

edited 08 Dec '13, 23:53


JQuery to the rescue.

Text fields in formspider are < input > elements. You must attach an event to each existing and future input element, by using the (deprecated now) live function. I modified my main.jsp, and add a reference to a custom js file. inside this file added the following function: function enableSelectAll() { $("input").live("focus", function(){ this.select(); }); } Add a post-open application event that calls the following action: procedure setSelectText is fParams formspider.api_externalmethod.tt_params; begin formspider.api_externalmethod.invoke('setSelectText', fParams); end; Don't forget to declare the external-event named setSelectedText.

You can further improve the function by using more specific jquery selectors. For example using the styleClass property and select only that class.

Akis

link

answered 28 Aug '14, 17:10

Vlisidis%20Akis's gravatar image

Vlisidis Akis
163119
accept rate: 5%

edited 28 Aug '14, 17:24

Hello Akis,

many thanks for reply.

One question, where can I declare the external-event?

Is it: "Miscellaneous > External Methods" section?

Tomas

(29 Aug '14, 05:18) Tomeo

Yes. name:setSelectText.Is the name you use to call the external method using the api_externalmethod.invoke.

javascript signature:enableSelectAll(). should match the name of the javascript function.

(29 Aug '14, 11:49) Vlisidis Akis

Hi Ecky,

Unfortunately, this API does not exist in the current version of Formspider. I created an enhancement request for this issue in our issue management system for this case.

Kind Regards,
Yalim

link

answered 09 Dec '13, 04:35

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Hi folks,

any updates on this? Or temporary trick for selecting content of textfields once it receives a focus?

Many thanks, Tomas

link

answered 28 Aug '14, 06:27

Tomeo's gravatar image

Tomeo
162143
accept rate: 3%

Hi Tomas,

No, nothing I know of.

Kind Regards, Yalim

(28 Aug '14, 06:32) Yalim Gerger ♦♦

What a shame! :(

(28 Aug '14, 06:40) Tomeo
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×3
×1

Asked: 08 Dec '13, 23:37

Seen: 1,190 times

Last updated: 29 Aug '14, 11:49


© Copyright Gerger 2017