1

I have this below links in a vf page -

    <p style="line-height: 1.5em;list-style-position: initial;margin:0;padding:0;"><a onclick="callAction()" target="_blank" href="https://cs1.salesforce.com/00O80000002zam7" style="text-decoration:none;color:#1468b6; position: relative; left: -30px;">Test1</a></p> 
    <p style="line-height: 1.5em;list-style-position: initial;margin:0;padding:0;"><a target="_blank" href="https://cs1.salesforce.com/00OC0000006LnZ1" style="text-decoration:none;color:#1468b6; position: relative;left: -30px;">Test2</a></p>
<p style="line-height: 1.5em;list-style-position: initial;margin:0;padding:0;"><a target="_blank" href="https://cs1.salesforce.com/00OC0000006LaGZ" style="text-decoration:none;color:#1468b6; position: relative;left: -30px;">Test3</a></p>    
<p style="line-height: 1.5em;list-style-position: initial;margin:0;padding:0;"><a target="_blank" href="https://cs1.salesforce.com/00OC0000004l4vm" style="text-decoration:none;color:#1468b6; position: relative;left: -30px;">Test4</a></p>    
<p style="line-height: 1.5em;list-style-position: initial;margin:0;padding:0;"><a target="_blank" href="https://cs1.salesforce.com/00OC0000004l4vI" style="text-decoration:none;color:#1468b6; position: relative;left: -30px;">Test5</a></p>

And onclick i am calling action:function -

<script>
function callAction(){
  controllerAction();
}
</script>

  <apex:actionFunction name='controllerAction' action="{!openPage}" reRender='fm'>
    <apex:param name="report1" value="Test1" assignTo="{!report1}"/>
    </apex:actionFunction>

What i want is onclick i should be passing some value to function regarding which link i had clicked and assign the value to report1 variable.

2

In your <a> tag change the onclick to:

onclick="controllerAction('YOURVALUE')"

No need for the additional JS function callAction as the actionFunction creates a JS function with the actionFunction name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.