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

Not able to put validation rules.

I have a VisualForce page where I am using SalesForce controls like inputText..

I want to provide field level validations for the controls like inputText i am using in the VF page. I provided the filed validation as

Rule Name     No_Special_Characters_ExName  

Error Condition Formula     NOT(REGEX( Extranet_Name__c, "/^([a-zA-Z0-9_-]+)$/"))
Error Message     No Special Characters Allowed for this field.

But the problem is its not showing the validation error in the same page but showing it in the next page. The exception it showed is

Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, No Special Characters Allowed for this field.: [Id]

Why should it even go to insert? The validation should happen much before an insert. Please help
Validation formulas are enforced at the system level not the UI level.

This way if your user tried to create the same record through the API they would receive the same failure.
Steve ChadbournSteve Chadbourn
I have the same issue. The main question is how do we apply validation rules to a visualforce page so an error mesasge appears by the field if the rule is broken?
Surfacing validation errors is a known limitation that we are working to address in the next release. 


Was this ever addressed?  I am having this same issue... thanks!!