+ Start a Discussion
cldavecldave 

Validation rule help pls

Hi i'm trying to create a validation that only allows to save text field that contains Numbers [0-9] and Commas [,] any other characters or letter should fail to validate.

I would appreciate if anyone can help , as I was not able to figure it out

Thank you in advance
Best Answer chosen by cldave
Terence_ChiuTerence_Chiu
My apologies, the validation rule should actually read as:


TEXT(VALUE( SUBSTITUTE(Text_Field__c, ",", ""))) ==  "#Error!"
 

All Answers

Terence_ChiuTerence_Chiu
Hi, any reason why you are not using Number field instead ?
Terence_ChiuTerence_Chiu
Btw, I think this should work for a text field. The validation actually fails when it tries to evaluate the VALUE function, but I placed it within a TEXT function set the the DOES NOT EQUALS because the val rule requires a boolean value to be returned.

TEXT(VALUE( SUBSTITUTE(Text_Field__c, ",", ""))) <> "#Error!"
Terence_ChiuTerence_Chiu
My apologies, the validation rule should actually read as:


TEXT(VALUE( SUBSTITUTE(Text_Field__c, ",", ""))) ==  "#Error!"
 
This was selected as the best answer
cldavecldave
Sorry did not get the chance to try it before today. But the formual works !

Thank you very much :)