How do you force a post code response in a text box | XM Community
Skip to main content

How do you force a post code response in a text box


Forum|alt.badge.img

Hi. I'm asking a respondent to fill in their post code in a textbox in my survey. How can I force that the format they input the post code follows the correct UK post code format? For instance, in the UK the post code is EC1X 1AB (6 to seven alphanumeric characters)> Is there a way that the text box forces that the format is only like that?
Another question - is there a way for this to autopopulate - so when someone types EC1X - it will already show all the options - including the correct one which is EC1X 1AB - for instance

4 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • March 2, 2023

Autopopulation is definitely possible. You can look at libraries like select2 or autocomplete.


Forum|alt.badge.img

Thanks. Where is that in the toolbar?


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • March 2, 2023

That's going to require some custom coding. Search the community for examples of select2, you'll get some.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5926 replies
  • March 2, 2023

If you don't want to auto populate, you can use Custom Validation and regex. Refer to this for regex pattern.


Leave a Reply