Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem with State field when registering as new user


milauskas

Recommended Posts

Posted

I don't think this was happening until recently and I'm not sure of the cause (yet). WHen I register as a new user I fill out all my info. WHen I come the the State field it's just a regular text entry box (no pulldown with state/province names). I fill this out as well as the rest of the info then submit the form.

 

I am then taken to the same page again. The warning at the top say to "please select a state from the pulldown list." Now the state/province field IS a pulldown and I can successfully choose my state.

 

Does anyone know why this is happening? It's really annoying and I do need to fix it for my client. Help is greatly appreciated, as always. Thanks!

Posted

That's the normal behavior, you didn't miss anything. If you type in a 2 letter state abbreviation that can't be confused with any other state, then it lets you move on w/no error. If you give it anything else, it will give you the error and offer the dropdown box at that point.

 

It comes from this, in create_account.php

 

$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
	if (tep_db_num_rows($zone_query) == 1) {
	  $zone = tep_db_fetch_array($zone_query);
	  $zone_id = $zone['zone_id'];
	} else {
	  $error = true;

 

As an example, If I enter KS it can't find any other 'zone' in the us that is LIKE KS, so it knows its Kansas. If I enter MI, it's not smart enough to know it's Michigan (it is, isn't it? :huh: ) ... because MI is LIKE too many other 'zone' names ...minnesota, mississippi, etc. It just searches the US zones for anything with MI in it.

 

There's a contribution to add a state dropdown box, though. :D

Posted

What was happening when I first noticed it was that I entered CO for Colorado. I was taken through the registration process, then noticed that the state in my shipping address was AL (I guess Alabama is at the top of the list so it defaulted to this). Perhaps at this time I wasn't being prompted to enter my state via the pulldown (I can't recall). In any case, entering the 2-letter abbreviation isn't working automatically for me. That's why I'm confused.

Posted

Yes, it's a little strange.

 

For CO it should give you an error. It'll pick up any of these with CO in them...

 

Colorado

Connecticut

District of Columbia

New Mexico

Wisconsin

 

There are very few states where it only finds one match and moves on.

 

The state dropdown contribution is here

 

http://www.oscommerce.com/community/contri...,state+dropdown

 

There's another one here that might do the same thing, I'm not familiar with it

 

http://www.oscommerce.com/community/contri...,state+dropdown

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...