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
John NeffJohn Neff 

Can I pass a variable from a hyperlink into a visualforce page?

Hello, 

Is it possible to pass a variable from a hyperlink into a visualforce page? 

For example, if I have a visualforce page with three links to anothe page: 

Red
Green
Blue

Can I have all three of those links point to the same vf page, but the page will render differently depending on which link was clicked? 

So that clicking on the "Red" link would allow me to use an argument like this: 
 
<apex:repeat value="{!listOfObjects}" var="object>
<apex:outputPanel rendered="{!IF(object.Custom_Field_With_Field_Value_Of_Red__c = Variable_Passed_in_by_URL, true, false)}">

Is this remotely possible at all? 

If so how would I do this?  
 
kevin lamkevin lam
Yes, you can pass that variable to your visualforce page and then use it like this:

<apex:outputPanel rendered="{!IF(object.Custom_Field_With_Field_Value_Of_Red__c = $CurrentPage.parameters.variable, true, false)}">