Salesforce Apex

Salesforce

How to print a Visualforce page in Salesforce?

Sample Code: Visualforce page: <apex:page showHeader="false" controller="Sample" > <apex:panelGrid width="100%" style="text-align:right;"> <apex:form > <apex:commandLink value="Print" onclick="window.print();"/> </apex:form> </apex:panelGrid> <apex:pageBlock title="Member Information"> <apex:pageBlockTable value="{!MemberList}" var="m"> <apex:column value="{!m.Name}"/> <apex:column value="{!m.City__c}"/> <apex:column value="{!m.Country__c}"/> ....

Salesforce

How to add error message in Visualforce page?

Sample Code: Visualforce page: <apex:page controller="Sample" sidebar="false" ><apex:pagemessages /><apex:form >    <apex:pageblock >              <apex:pageBlocksection >            <apex:pageblockSectionItem >Name:</apex:pageblockSectionItem>            <apex:pageblockSectionItem ><apex:inputtext value="{!nam}" /></apex:pageblockSectionItem>                      <apex:pageblockSectionItem >Age:</apex:pageblockSectionItem>                      <apex:pageblockSectionItem ><apex:inputtext value="{!age}" /></apex:pageblockSectionItem>                  ....