+ Start a Discussion
learnSFlearnSF 

customise required field message in visual force page

Hi,

 

I have visual force page where user can enter first name and last name. I made both fields as required with tag required="true" in input text.

 

I see that when user don't enter that field and hit register button, visual force shows message like "
  • j_id0:j_id31:j_id36: Validation Error: Value is required." I want to customize this message as "Validation Error: Value is required".
  •  

    Any help?

     

    Thanks

Best Answer chosen by Admin (Salesforce Developers) 
BeeddiskShahBeeddiskShah

This is a simple common problem, there are two approaches for this...

 

1) Give Id's across all hierachy. I.e., to pageblock, to form etc.

2) Chuck the 'required=true' thing and write a brand new error handling code, and when you have to display error, say...

 

object.fieldname.adderror('Some complicated confusing error to confuse the user to never use the system again.');

 

Hope it helps,

the Ravan

http://force.siddheshkabe.co.in

All Answers

anjaliguptaanjaligupta
Hi, For this issue, you can use tag in your Visualforce page to show error message in your language.
BeeddiskShahBeeddiskShah

This is a simple common problem, there are two approaches for this...

 

1) Give Id's across all hierachy. I.e., to pageblock, to form etc.

2) Chuck the 'required=true' thing and write a brand new error handling code, and when you have to display error, say...

 

object.fieldname.adderror('Some complicated confusing error to confuse the user to never use the system again.');

 

Hope it helps,

the Ravan

http://force.siddheshkabe.co.in

This was selected as the best answer