Zone (state/province) validation error
ajrock2000 - May 16, 2009 - 00:24
| Project: | Ubercart Addresses |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | ajrock2000 |
| Status: | active |
Jump to:
Description
I am having an issue on a site of mine that when a user registers, it is setup to make them enter an address. There are certain countries that don't return any state/provinces and it shows "Non-Applicable", but when the form is submitted, it gives an "State/Province field is required." error and there is no way for the user to proceed. You can test this issue by going to http://www.openhisword.com/user/register and select for instance, "TANZANIA, UNITED REPUBLIC OF" from the drop down. Any ideas?
Thanks!

#1
This should work the same was as for the checkout billing and delivery addresses. Do you only have the problem with when registering (and not on checkout)?
#2
I am the guy aj built the site for. We've got it setup so users must login or create an account before they can go to check out. So we would like to be able to have state/province not required for the countries that don't have them. We get a lot of international customers. Thanks for you help!!
#3
I'm sorry but I still need an answer to my question: does this problem only occur during registration or does it also occur during checkout?
#4
Yeah, no problems if an unregistered user checks out. Same n/a in the state field, but it lets you complete the check-out.
#5
Thanks for the response. I was hoping for a different answer so I could send you over to the Ubercart people :-)
Continued maintenance of this module is not my highest priority. If you need a fix for this anytime soon, you're probably going to have to find the problem (and solution) yourself. If you're not a programmer, you can hire me (which increases the priority dramatically) or hire someone else and have them fix the bug and submit a patch (so the fix gets included in future updates).
If this is not critical, you could wait until I get around to looking at this.
#6
I am a programmer myself, but I have no experience with drupal. Can you give me any hints as to where the validation logic is located?
#7
Of course. It's not super-hard, although you may wind up tracing through Ubercart code.
I assume you know where the modules are located. If not, look for folders called "uc_addresses" and "ubercart".
Start with uc_addresses. There are only two files to worry about: uc_addresses.module and uc_addresses_address_pane.inc. The latter may do the validation or it may pass it off to uc_addresses.module. I included a lot of comments, so it shouldn't be too hard to find.
The next step should be to look into ubercart. It's divided into sub-modules. Since the checkout code works, it might be nice to compare it to the code I use. The uc_addresses code started as a clone of uc_order and maybe parts of uc_cart (someone else started writing uc_addresses and I took it over), so check there.
When you run into a function call and you don't know what it is, use Google and type in the name. This usually leads you to the documentation.
Good luck! If you fix the problem, please send in a patch so your fix doesn't get wiped out by future releases of uc_addresses.