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
PerPer 

Field validation

I am new to this, so excuse my ignorance. However, what would be the way to validate a field, e.g. that a valid US state code is entered in the billing address state field, and if not, give the user an error message?

Rgds,
Per

DevAngelDevAngel

Hi Per,

I would replace the state field for billing with a custom field that is a picklist of all possible states.  The user then needs to select the picklist value and, although it may be the wrong state, it will be a valid state.  If you wanted to verify the it is the right state, you would need and external process that occasionally checks the zip against the state and corrects any inconsistencies.