Results 1 to 10 of 17

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Moving "country" field breaks state field

    The country on the account create IMHO should appear before the state dropdown selector since the states change based on the country selected. It makes no sense when using the state dropdown that country appears AFTER the state.. So I want to move it so that country is selected BEFORE choosing a state and improve the usability/logic of this form.

    I have my customer state settings "State Always as a Pulldown" in my admin. Moving the country selector in the Account Create file "breaks" the state field. After moving the country field BOTH the dropdown and the text field both display.. Not sure how to fix this.. I'm not seeing anything that would cause this, and I know this is something OBVIOUS I am missing..

    Here's the code I am using..
    Code:
    <fieldset>
    <legend><?php echo TABLE_HEADING_ADDRESS_DETAILS; ?></legend>
    <?php
      if (ACCOUNT_GENDER == 'true') {
    ?>
    <?php echo zen_draw_radio_field('gender', 'm', '', 'id="gender-male"') . '<label class="radioButtonLabel" for="gender-male">' . MALE . '</label>' . zen_draw_radio_field('gender', 'f', '', 'id="gender-female"') . '<label class="radioButtonLabel" for="gender-female">' . FEMALE . '</label>' . (zen_not_null(ENTRY_GENDER_TEXT) ? '<span class="alert">' . ENTRY_GENDER_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <label class="inputLabel" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label>
    <?php echo zen_draw_input_field('firstname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' id="firstname"') . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="lastname"><?php echo ENTRY_LAST_NAME; ?></label>
    <?php echo zen_draw_input_field('lastname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', '40') . ' id="lastname"') . (zen_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="alert">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="street-address"><?php echo ENTRY_STREET_ADDRESS; ?></label>
      <?php echo zen_draw_input_field('street_address', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', '40') . ' id="street-address"') . (zen_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="alert">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <?php echo zen_draw_input_field('should_be_empty', '', ' size="40" id="CAAS" style="visibility:hidden; display:none;" autocomplete="off"'); ?>
    
    <?php
      if (ACCOUNT_SUBURB == 'true') {
    ?>
    <label class="inputLabel" for="suburb"><?php echo ENTRY_SUBURB; ?></label>
    <?php echo zen_draw_input_field('suburb', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', '40') . ' id="suburb"') . (zen_not_null(ENTRY_SUBURB_TEXT) ? '<span class="alert">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <label class="inputLabel" for="city"><?php echo ENTRY_CITY; ?></label>
    <?php echo zen_draw_input_field('city', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . ' id="city"') . (zen_not_null(ENTRY_CITY_TEXT) ? '<span class="alert">' . ENTRY_CITY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY; ?></label>
    <?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" ' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')) . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    
    <?php
      if (ACCOUNT_STATE == 'true') {
        if ($flag_show_pulldown_states == true) {
    ?>
    <label class="inputLabel" for="stateZone" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
    <?php
          echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $zone_id, 'id="stateZone"');
          if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert">' . ENTRY_STATE_TEXT . '</span>';
        }
    ?>
    
    <?php if ($flag_show_pulldown_states == true) { ?>
    <br class="clearBoth" id="stBreak" />
    <?php } ?>
    <label class="inputLabel" for="state" id="stateLabel"><?php echo $state_field_label; ?></label>
    <?php
        echo zen_draw_input_field('state', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"');
        if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert" id="stText">' . ENTRY_STATE_TEXT . '</span>';
        if ($flag_show_pulldown_states == false) {
          echo zen_draw_hidden_field('zone_id', $zone_name, ' ');
        }
    ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    
    <label class="inputLabel" for="postcode"><?php echo ENTRY_POST_CODE; ?></label>
    <?php echo zen_draw_input_field('postcode', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . ' id="postcode"') . (zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="alert">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    </fieldset>
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Moving "country" field breaks state field

    Hate to bump this, but the double state fields can be seen here:
    https://www(dot)tablelegworld(dot)co...create_account

    I can simply delete the text state field. However for countries with no defined states, the text field is supposed to display when one of these countries is chosen.

    Anyone got a CLUE why moving the country field makes both the dropdown and text field display and more importantly HOW to fix this???
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Moving "country" field breaks state field

    Quote Originally Posted by DivaVocals View Post
    Anyone got a CLUE why moving the country field makes both the dropdown and text field display and more importantly HOW to fix this???
    I do! Sort of.

    BUT..... I'm about to call it quits for the night (3:40am) and I can't recall the exact details. I can tell you that it had something to do with the javascript & css though.

    I pretty much stumbled across this when the client reported that when there was nothing to populate the State dropdowns there was supposed to be a text input field, but this field was missing. After viewing the page source I discovered it wasn't actually 'missing' but simply 'hidden', and that led me back to the javascript.

    It seems that you have the opposite problem in that the text field *isn't* being hidden when it should be.. hence both the dropdown and the text field being displayed.

    Hopefully this is the 'clue' that you need to resolve your problem. If not I'll see if I can find any notes that I left for myself regarding this matter for you tomorrow.

    Cheers
    RodG

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Moving "country" field breaks state field

    Quote Originally Posted by RodG View Post
    I do! Sort of.

    BUT..... I'm about to call it quits for the night (3:40am) and I can't recall the exact details. I can tell you that it had something to do with the javascript & css though.

    I pretty much stumbled across this when the client reported that when there was nothing to populate the State dropdowns there was supposed to be a text input field, but this field was missing. After viewing the page source I discovered it wasn't actually 'missing' but simply 'hidden', and that led me back to the javascript.

    It seems that you have the opposite problem in that the text field *isn't* being hidden when it should be.. hence both the dropdown and the text field being displayed.

    Hopefully this is the 'clue' that you need to resolve your problem. If not I'll see if I can find any notes that I left for myself regarding this matter for you tomorrow.

    Cheers
    RodG
    Well I get why now.. now I just need a hand at the fix.. Messing around with PHP is one thing.. javascript.. well... can you say OVER MY HEAD.. Get some rest.. when you are upright again, I could sure use a hand at fixing this.. **pretty please**
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Moving "country" field breaks state field

    Quote Originally Posted by DivaVocals View Post
    Well I get why now.. now I just need a hand at the fix.. Messing around with PHP is one thing.. javascript.. well... can you say OVER MY HEAD.. Get some rest.. when you are upright again, I could sure use a hand at fixing this.. **pretty please**
    Confession time: I'm not all that great with Javascript either (I find it a real pain to debug). I tend to do a lot of cutting n pasting and a lot of trial and error to get it to do what I want it too. I'm sure I fixed my clients problem with more luck than skill. :)


    G'night.
    RodG

  6. #6
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Moving "country" field breaks state field

    Hey Diva,
    Was that the correct link in your earlier post? What I see when I display that page is the normal create account page with the state before the country.

  7. #7
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Moving "country" field breaks state field

    I just refreshed the page and saw things rearranged. It seems to be working correctly so hopefully you fixed it.

 

 

Similar Threads

  1. How do I make "State" NOT a Required Field?
    By spanweb in forum General Questions
    Replies: 2
    Last Post: 5 May 2010, 03:33 PM
  2. increasing the field size of the "products_models" field in the "products" table
    By bod in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 5 Feb 2010, 06:29 AM
  3. "(7) 7 - Field format error: 10731-The field Shipping Address Country is required
    By GTrotter in forum PayPal Express Checkout support
    Replies: 73
    Last Post: 1 Sep 2009, 03:15 AM
  4. I need to make the "company" field a required field
    By semaxd in forum Managing Customers and Orders
    Replies: 2
    Last Post: 30 Jun 2008, 09:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg