function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DevSFDC22DevSFDC22 

Validate user input on ui.

Hi,
I'm using an input field in visualforce and want to validate the user input on UI itself. Example: inputtext What is your country?
if user enter restricted country then error should come.

How I can achieve this ?
ShirishaShirisha (Salesforce Developers) 
Hi Sid,

Greetings!

You can simply create the validation rule based on the user input and use the field which will throw the error,if they entered the value on the Save function.

Otherwise,you can simply use the JavaScript function to validate the inputs.Please refer the sample code in the below thread.

https://developer.salesforce.com/forums/?id=906F000000095DwIAI

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri