You need to sign in to do that
Don't have an account?

Can we localized standard page messages like "required" message on vf page?
I have to localize this standard "Validation Error: Value is required.". Is there a way in salesforce to localized such standard messages?
Yes You can, for this work around you can follow the below Steps
Steps :
Step 1: First we need to use required="false" for that field as shown in the below piece of code.
<apex:inputField value="{!acc.name}" required="false"/>
Step 2: To make that field required use the sample code below.
<apex:pageBlockSectionItem > Account Name
<apex:outputPanel layout="block" style="float: left">
<apex:outputPanel >
<div class="requiredInput"><div class="requiredBlock"/>
<apex:inputField value="{!acc.name}" required="false" />
</div>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
Example :
Apex Class : StandardErrorOverrideController
public class StandardErrorOverrideController {
public account acc {get;set;}
public StandardErrorOverrideController() {
acc = new Account();
}
public void saveData() {
try {
insert acc;
} catch(DMLException e) {
if(acc.name =='' || acc.name == null) {
acc.name.addError('Account Name Cannot be Null');
}
}
}
}
Visualforce Page :
<apex:page controller="StandardErrorOverrideController">
<apex:form >
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!saveData}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:pageBlockSectionItem > Account Name
<apex:outputPanel layout="block" style="float: left">
<apex:outputPanel >
<div class="requiredInput"><div class="requiredBlock"/>
<apex:inputField value="{!acc.name}" required="false" />
</div>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:inputField value="{!acc.site}"/>
<apex:inputField value="{!acc.type}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Regards,
Ahmed Ansari