+ Start a Discussion

Click on link to display text at cursor point in textbox



I want a functionality in which i create Link(maybe apex:outputLink) so that it appends certain text into the textbox after the cursor position.


Example senario. when I click on the Link [First Name] it must append First_Name__c in the textbox at the cursor point


exaple text in text box before : Welcome home


after clicking the link : Welcome home First_Name__c


I am okay with using a pickList insted of Link. So that when a First Name is selected it must dynamically append First_Name__c to the text in the textbox.


Even a javascipt code will be helpful.


Thanks in advance.

Maros SitkoMaros Sitko

Use apex:actionSupport or onclick, which call actionFunction. Both than should execute apex method of your controller/extension, which fill First_Name__c and both should have rerender attribute, which rerender textbox (probably you have apex:inputText). The not forgot, that you should not rerender simple inputText (inputfield,...), but you should rerender parent tag : for example outputPanel