function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RSKRSK 

Issue with passing parameters to <apex:outputLink>

Hi,

 

I'm facing an issue while passing parameters with <apex:outputLink> to a VF page , if the parameter value having the '&' char  ( For example : CompanyName is P & B Computers), it takes '&' as a separator and displays only the text before '&' (ex:  P as the CompanyName).

 

Here is the Code :

 

<apex:outputLink value="/apex/CompanyPage_VF?companyName={!a.companyName}&street={!a.street}&city={!a.City}&state={!a.State}&country={!a.Country}" id="theLink">
             Click Here
          </apex:outputLink> 

 

Any help must be appreciated.

 

Thanks

Kumar




Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

This sounds like something that the URLENCODE function can help with.  Try:

 

<apex:outputLink value="/apex/confirmPage_VF?companyName={!URLENCODE(a.companyName)}&street={!a.street}&city={!a.City}&state={!a.State}&country={!a.Country}" id="theLink"> 
             Click Here
          </apex:outputLink> 

 

All Answers

bob_buzzardbob_buzzard

This sounds like something that the URLENCODE function can help with.  Try:

 

<apex:outputLink value="/apex/confirmPage_VF?companyName={!URLENCODE(a.companyName)}&street={!a.street}&city={!a.City}&state={!a.State}&country={!a.Country}" id="theLink"> 
             Click Here
          </apex:outputLink> 

 

This was selected as the best answer
RSKRSK

It works like a charm !.

 

Thank you very much.

Kumar