1

Drupal Commerce uses Address Field for its billing information. Street addresses are implemented as Address 1 and Address 2 lines. No other fields will be added to the module, since they want to keep it simple and follow the xNAL standard.

So how are people doing validation of user input? Specifically, how do you make sure they don't forget the housenumber? This happens, and it means extra work for the shop contacting the customer if it's noticed in time, otherwise an undeliverable package will be sent.

One solution would be a separate required field for house number, but I haven't seen a clean way of doing that (see e.g. this). Or perhaps dynamic validation of the Address field. So what are Drupal Commerce shops using? Any examples or recommended approaches?

5
  • I can't speak for anyone else but to me, trying to go against the xNAL standard seems counter-intuitive. House numbers aren't a required part of an address, so if you try to enforce one you're going to be stopping users whose address has no house number from ordering. Either way I think you'll have to hack at the address field module to accomplish this - as you rightly say, they've made the decision to follow the internationally accepted standard. So the code and workflow of the module will inevitably reflect that.
    – Clive
    Jul 4, 2013 at 11:18
  • It wouldn't have to be against the standard I think, there are apparently proper xNAL elements like ThoroughfareNumber, but I suppose it's complex to do this properly for all countries.
    – arjan
    Jul 4, 2013 at 12:09
  • Not complex...incorrect :) House numbers are not a required part of an address in any country as far as I know
    – Clive
    Jul 4, 2013 at 12:10
  • Then it could be optional. A separate field would also make it more feasible to ask the customer for confirmation if house number is left empty.
    – arjan
    Jul 4, 2013 at 12:15
  • In that case your only option is text cues - you can't enforce any sort of real validation. You might as well just add a description to the Street Address 1 field saying 'Don't forget your house number if it's applicable'. It would accomplish exactly the same thing as separating out the house number into its own, optional textfield, but with much less work
    – Clive
    Jul 4, 2013 at 12:18

0

Your Answer

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

Browse other questions tagged or ask your own question.