Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

aqualynx

Archived
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Real Name
    Rob

aqualynx's Achievements

  1. I doubt it to tell you the truth, because each time a new country is selected, it has to get information about that country and its zones from the database on the server using php. You could somehow create a flat file database with the states (which wouldn't be too bad because only Germany, Canada and the US have states in the database to my knowledge) and use javascript to manipulate what options are displayed in the states field when those particular countries are selected. However, that would be pretty hardcore and would require ensuring the data being manipulated by javascript is related properly back to oscommerce. Not impossible, but it would require a fair bit of work...
  2. I've actually been looking into this a little bit more and recoded the function so it can be reused by anyone who needs a refresh form function. It also checks for the existence of the state field and only wipes it clean if it fits the parameters needed for the country-state selector. I've tested it cross-platform on ie, opera and firefox 0.9. It might be a little overkill, but take a look and see what you think... <?php // +Country-State Selector ?> function refresh_form(form_name) { form_name.action.value = 'refresh'; if (testIsValidObject(form_name.state)) { if (form_name.state.type == 'text') { form_name.state.value = ''; } else if (form_name.state.type == 'select-one') { for (var i=form_name.state.options.length-1; i>=0; i--) { form_name.state.options[i] = null; } form_name.state.selectedIndex = -1; } } form_name.submit(); return true; } function testIsValidObject(objToTest) { if (null == objToTest) { return false; } if ("undefined" == typeof(objToTest) ) { return false; } return true; } <?php // -Country-State Selector ?>
  3. I'm using firefox 0.9 on linux at this point, but this bug appears in firefox 0.9 on windows as well. I'm going to double check for this bug in opera and ie... I don't understand why the value of the state field isn't ignored on refresh, since the field type is changing... Alright, testing in opera shows that it doesnt have the problem at all... Whether the refresh_form js function is same as original, or changed according to my last post, they both work properly... Testing is showing the same results in ie as in opera. Both ie and opera don't have the problem, but the fix doesn't cause any harm (no js errors that i saw), and takes care of the problem on firefox 0.9.
  4. I believe i've found the solution to that problem you're having. It has to do with the javascript refresh page function. When the country selected already has states, and you attempt to switch to a country that has no states, the javascript function tries to clear a text field, but it should be emptying a combo box instead. I've changed the function in form_check.js.php so it looks like the following: <?php // +Country-State Selector ?> function refresh_form(form_name) { form_name.action.value = 'refresh'; if (form_name.state.type == 'text') { form_name.state.value = ''; } else { for (var i=form_name.state.options.length-1; i>=0; i--) { form_name.state.options[i] = null; } form_name.state.selectedIndex = -1; } form_name.submit(); return true; } <?php // -Country-State Selector ?> This code assumes that if the type of the state field is text (a country with no list of states), it will clear it normally, but otherwise, it will assume the state field is a combo box and remove the options from the combo box. This has cleared the bug for me... Hope this helps out...
×
×
  • Create New...