AnswerBun.com

calling a javascript method to display a value on Output box by clicking apex command link

Salesforce Asked by CRM Guy on November 11, 2020

I am trying a scenario where on clicking a apex commandlink I need to capture a field’s value and that value should be displayed on the same page in a seperate output text box or input text field.
“theDescription” field should be auto populated with the description selected when I click on the command link section.

Here is the code sample I used but some how its not working. Can you pls help?

<apex:inputField id="theDescription" required="true" value="{!strategy.Strategy_Description__c}" style="width:300px;height:100px;" />

<apex:commandLink id="linka" onclick="showData('{!$Component.linka}');" oncomplete="checkExistingDesc(); return false;" status="disableButtonForMultipleClicks" rerender="theDescription">{!a.Name}

function showData(id)
{
    var v = document.getElementById(id);
    alert ('Hi--------------------'+v);
}

One Answer

Try this if it helps : It will give alert of value you have entered in the "theDescription" field.

    <apex:inputField id="theDescription" required="true" value="{!strategy.Strategy_Description__c}" style="width:300px;height:100px;" />

   <apex:commandLink id="linka" onclick="showData('{!$Component.linka}');" oncomplete="checkExistingDesc(); return false;" status="disableButtonForMultipleClicks" rerender="theDescription">{!a.Name}

     function showData()
     {
      var v = document.getElementById(theDescription);
      alert ('Hi--------------------'+v);
     }

Answered by Salesforce Steps on November 11, 2020

Add your own answers!

Related Questions

Set Padding on Minimum Width [Aura]

1  Asked on October 4, 2021 by al-k

   

restrict past dates in lightning:input

1  Asked on October 4, 2021 by krishna-casukhela

 

Why is SystemModStamp missing updates?

1  Asked on October 4, 2021 by sebthu

 

Marketing Cloud Barcodes

0  Asked on October 4, 2021 by john-green

     

Comments in Salesforce contact email address

0  Asked on October 4, 2021 by andrey-osh

   

SOQL Parser implementation in Apex

1  Asked on October 4, 2021 by robert-ssemann

       

How to find code deprecated by Salesforce?

1  Asked on October 4, 2021 by sf-ninja

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir