How to override field labels in visualforce page? <apex:page standardController=”Account” recordSetVar=”accs”> <apex:form > <apex:pageBlock title=”Std List Controller Demo”> <apex:pageBlockTable value=”{!accs}” var=”a”> <!– how to override the sObject label using facet–> <apex:column value=”{!a.Name}”> <apex:facet name=”header”>Company Name</apex:facet> <!– header footer caption –> </apex:column> <apex:column headerValue=”Industry”> <apex:inputField value=”{!a.Industry}”/> </apex:column> <apex:column value=”{!a.Phone}”/> <!– how to override the sObject label –> <apex:column headerValue=”Company Type” value=”{!a.Type}”/> </apex:pageBlockTable> <apex:pageBlockButtons > <apex:commandButton value=”Update” action=”{!save}”/> <apex:commandButton value=”Next” action=”{!Next}”/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
Read MoreDay: August 11, 2017
Difference – pageBlockTable, dataTable, dataList and Repeat in Visualforce Page
Difference – pageBlockTable, dataTable, dataList and Repeat in Visualforce Page <apex:page standardController=”Account” recordSetVar=”Accounts”> <apex:form > <apex:pageBlock title=”pageBlockTable Demo”> <apex:pageBlockTable value=”{!Accounts}” var=”a” border=”1″ cellpadding=”1″> <apex:facet name=”caption”>Account Records</apex:facet> <apex:column headerValue=”Name” value=”{!a.Name}”/> <apex:column value=”{!a.Industry}”> <apex:facet name=”header”>Industry</apex:facet> </apex:column> <apex:column value=”{!a.Phone}”> <apex:facet name=”header”>Phone</apex:facet> </apex:column> <!–<apex:facet name=”footer”>Account Records Ends</apex:facet> –> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title=”DataTable Demo”> <apex:dataTable value=”{!Accounts}” var=”a” border=”1″ cellpadding=”1″> <apex:facet name=”caption”>Account Records</apex:facet> <apex:column headerValue=”Name” value=”{!a.Name}”/> <apex:column value=”{!a.Industry}”> <apex:facet name=”header”>Industry</apex:facet> </apex:column> <apex:column value=”{!a.Phone}”> <apex:facet name=”header”>Phone</apex:facet> </apex:column> <!–<apex:facet name=”footer”>Account Records Ends</apex:facet> –> </apex:dataTable> </apex:pageBlock> <apex:pageBlock title=”Datalist Demo”> <apex:dataList value=”{!Accounts}” var=”a”> <apex:outputField value=”{!a.Industry}”/> </apex:dataList> </apex:pageBlock> <apex:pageBlock title=”repeat Demo”>…
Read MoreHow to read write values between Visualforce page and Apex
How to pass values between Visualforce page and Apex Apex Class: public class DemoController { public String name {get; set;} public String city {get; set;} public DemoController(){ name = ‘Ranjith’; city = ‘Chennai’; } } Visualforce: <apex:page controller=”DemoController”> <apex:form > <apex:pageBlock > {!name} <br/> {!city} </apex:pageBlock> </apex:form> </apex:page>
Read MoreRefresh part of visualforce using reRender
Refresh part of visualforce using reRender Apex Class public with sharing class ActionDemoController { public String name {get; set;} public void show(){ name = ‘inside the show method’; } } Visualforce <apex:page controller=”ActionDemoController” id=”page”> <!– to refresh part of the page, use the reRender attribute along with action component –> <apex:form id=”fm” title=”main block”> <apex:pageBlock id=”pb1″> <apex:commandButton value=”call show” action=”{!show}” reRender=”pb2″/> </apex:pageBlock> <apex:pageblock title=”result” id=”pb2″> {!name} </apex:pageblock> </apex:form> </apex:page>
Read More