Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How do I allow multiple formats in a required field?

Avatar

Former Community Member

Hi,   

In this case I am trying to validate a zip code field to allow U.S., Canada, and UK zip codes.  How would I do this?  I tried using the attached image, but it gives me an error when I enter a nine-digit U.S. zip code, like 12345-6789.  I want the field to be able to accept the four different zip code formats below.  Thank you for your help.

es3zipcodevalidation.JPG

1 Accepted Solution

Avatar

Correct answer by
Level 10

I've never tried doing that many different types in one go but I Just tried it and it seems to work.

All the stuff you have in the Validation field should also be in the Edit and Display tabs. The Validate patterns validate to the Display patterns (if the data displays properly then it will validate). The Edit pattern controls the different ways data can be entered.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

I've never tried doing that many different types in one go but I Just tried it and it seems to work.

All the stuff you have in the Validation field should also be in the Edit and Display tabs. The Validate patterns validate to the Display patterns (if the data displays properly then it will validate). The Edit pattern controls the different ways data can be entered.