How to Pass Javascript parameters to Apex in Salesforce ?

How to Pass Javascript parameters to Apex in Salesforce ?


To pass javascript parameters in apex you could use following code below :


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<apex:page controller="passParam">
    <apex:form>
        <script>
         function passParam()
            {
             document.getElementById("{!$Component.jsValue}").value = "I am from Javascript";
            }
        </script>
        <apex:inputHidden id="jsValue" value="{!getValue}" />
    </apex:form>
</apex:page>

You can call this function on button's click to get value in your apex inputs.

Share this post with your friends if this help you somehow.


Post a Comment

0 Comments