I want to pass encodeURIComponent("{!Account.Name}"); to some apex variable. How can I achieve this?

I will be using ecnocded value in my page.

  • use apex:param to pass parameter in apex controller. – Tushar Sharma Jan 17 '17 at 5:32
  • I need to set the value to encodeURIComponent("{!Account.Name}") before passing it to controller – Abi Jan 17 '17 at 6:11
  • why you need to pass this value to controller {!Account.Name} you can directly get this value from standard controller in apex.. – Ratan Paul Jan 17 '17 at 7:37
  • I want the encoded {Account.Name} value to the controller – Abi Jan 17 '17 at 8:17

Through the use of actionFunction with <apex:param/> you can pass value to the controler:

You can pass value as "{!Account.Name}" in the javascript method.

<script type="text/javascript">
      function displayFunc(value)
<apex:actionFunction name="passValueToController" action="{!passValue}" immediate="true" reRender="form1">
     <apex:param id="selectedValue" name="selectedValue" value=""/> 

public void passValue()
      fieldValue = ApexPages.currentPage().getParameters().get('selectedValue');
      System.debug('fieldValue=' + fieldValue);     
| improve this answer | |

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.