Our back-end system only accepts Canadian postal codes as "XXX XXX." Is there an easy way for me to customize the form field to force in that middle space so that the data is collected and exported in the required format?

1 Answer 1


In general, it's a good idea to be flexible and allow both XXX XXX and XXXXXX as entries, and let the system convert the latter option by inserting a space at the right position. Unlike e.g. a credit card number or a serial key, this is a short field and unlikely to cause mistypings.

(For comparison: I'm from the Netherlands; our postal codes look like 1234 AB with or without a space in the middle. It varies from person to person and from system to system which format they prefer.)

How this conversion is done is an implementation question, which is off-topic for this site. It will depend heavily on the type of system / programming language / framework you're working with.

  • 1
    While this is true, it isn't actually an answer to the question. OP said 'How do I do X' and you've answered 'Don't do X, do Y'. There could be many reasons why they have to have X (old legacy systems, no back-end development resource...) so ideally we should focus answers specifically on the question itself.
    – JonW
    Aug 30, 2018 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.