Posts

Showing posts with the label Render

Conditionally render fields on Visualforce page based on picklist values

 An example of how to render a Visualforce page based on criteria. <apex:pageBlock id="xxxpb1"> <apex:pageBlockSection>                      <apex:actionRegion >                  <apex:inputField id="xxxif1" value="{!Object.picklistfieldapiname1}" required="true" >      <apex:actionSupport event="onchange" rerender="xxxpb1" />   </apex:inputField> </apex:actionRegion>                   </apex:pageBlockSection>                 <apex:pageBlockSection id="xxxpbs1" rendered="true">  <apex:inputField id="xxxif2" value="{!Object.Fieldtobedisplayed1}" rendered="{!IF(Object.picklistfieldapiname1 ='picklist value 1' || lead.Buyer_Type__c ='picklist value 2' ,true,false)}"/> </apex:pageBlockSection> <apex:pageBlockSec...

Use of render, rerender, and renderAs in Salesforce

In Salesforce, render, rerender, and renderAs are terms used in the context of Visualforce pages and components. Each term relates to a different aspect of how Visualforce content is displayed or processed. render determines whether a component should be displayed on the page based on a condition. rerender specifies which components should be updated with new data after an AJAX action. renderAs defines the format in which the Visualforce page should be rendered, such as PDF, Excel, or CSV. render : Usage : Used in Visualforce components and tags to define the conditions under which the component or tag should be rendered on the page. Description : The render attribute specifies a Boolean value or expression that determines whether the associated component or tag should be rendered (displayed) on the page. If the value evaluates to true, the component is rendered; otherwise, it is omitted from the page's HTML output. Example : <apex:outputText value="Hello World!" re...

Rendering PDF Files Using Visualforce Page

Rendering PDF files using a Visualforce page in Salesforce is a common requirement, especially when you need to generate printable documents such as reports, invoices, or statements. Salesforce provides a way to generate PDF files directly from Visualforce pages using the renderAs attribute.    Visualforce <apex:page controller="PDFRenderingController" renderAs="pdf">   <apex:form >     <apex:pageBlock >         <apex:pageBlockTable value="{!accList}" var="acc" border="2">            <apex:column value="{!acc.Name}"/>            <apex:column value="{!acc.AnnualRevenue}"/>            <apex:column value="{!acc.Type}"/>            <apex:column value="{!acc.AccountNumber}"/>            <apex:column value="{!acc.Rating}"/>       ...