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
Jonathan Wolff 7Jonathan Wolff 7 

render content in Visualforce depending on selected value

Hello, I made a picklist in Campaign (PDF_Vorlage__c) with the 2 values 'Volage 1' and 'Vorlage 2'.

I also created a visualforce that I inserted in campaign page.
I want to achive that when I select the value 'Vorlage 1' , the visualforce should show 'This is Vorlage 1' and the same if Vorlage 2 is selected.

Could you modify my Visualforce so I can test it?

VF:

<apex:page standardController="Campaign" renderAs="pdf">
    <apex:repeat value="{!Campaign.CampaignMembers}" var="cMem">
        <div style="page-break-after:always;"> 
            <h1>Welcome to APP!</h1>
            <p>Thank you, <b><apex:outputText value=" {!cMem.Name}"/></b>, for working with APP.</p>
            <p>Your campaign details are:</p>
            <table>
                <tr><th>Account Name</th>
                    <td><apex:outputText value="{!Campaign.Name}"/></td>
                </tr>
                <tr><th>Account Rep</th>
                    <td><apex:outputText value="{!Campaign.Owner.Name}"/></td>
                </tr>
                <tr><th>Customer Since</th>
                    <td><apex:outputText value="{0,date,long}">
                        <apex:param value="{!Campaign.CreatedDate}"/>
                        </apex:outputText></td>
                </tr>
                
            </table>
        </div>
    </apex:repeat>
</apex:page>
Best Answer chosen by Jonathan Wolff 7
SwethaSwetha (Salesforce Developers) 
HI Jon,
You should be able to achieve this using the apex:actionFunction

See the examples listed in the below articles to  get started. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionFunction.htm
https://www.salesforcetutorial.com/actionfunction-tag/

Happy to help if you are stuck somewhere.

If this information helps, please mark the answer as best. Thank you