Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2010
    Posts
    27
    Plugin Contributions
    0

    Default Trouble making city+state fields readonly

    Hi,

    I have a local delivery service, and want to autofill the city and state for customers to avoid confusion.

    This is what I have so far. The city seems to autofill and readonly the field correctly, but the state, while it turns it to readonly OK, doesn't input the value I provide. I have State dropdown disabled.

    City:

    Code:
    <label class="inputLabel" for="city_shipping"><?php echo ENTRY_CITY; ?></label>
    <?php echo zen_draw_input_field('city_shipping', 'City', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . ' id="city_shipping" readonly="readonly"') . (zen_not_null(ENTRY_CITY_TEXT) ? '<span class="alert">' . ENTRY_CITY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    State:

    Code:
    <?php
      if (ACCOUNT_STATE == 'true') {
        if ($flag_show_pulldown_states_shipping == true) {
    ?>
    <label class="inputLabel" for="stateZone_shipping" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
    <?php
          echo zen_draw_pull_down_menu('zone_id_shipping', zen_prepare_country_zones_pull_down($selected_country_shipping), $zone_id_shipping, 'id="stateZone_shipping"');
          if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert">' . ENTRY_STATE_TEXT . '</span>'; 
        }
    ?>
    
    <?php if ($flag_show_pulldown_states_shipping == true) { ?>
    <br class="clearBoth" id="stBreakShipping" />
    <?php } ?>
    <label class="inputLabel" for="state_shipping" id="stateLabelShipping"><?php echo $state_field_label_shipping; ?></label>
    <?php
        echo zen_draw_input_field('state_shipping', 'State', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state_shipping" readonly="readonly"');
        if (zen_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="alert" id="stTextShipping">' . ENTRY_STATE_TEXT . '</span>';
        if ($flag_show_pulldown_states_shipping == false) {
          echo zen_draw_hidden_field('zone_id_shipping', $zone_name_shipping, ' ');
        }
    ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    Further, when I inspect it with Firebug, I get:

    City:

    Code:
    <input type="text" name="city_shipping" value="City" size="33" maxlength="32" id="city_shipping" readonly="readonly">
    State:

    Code:
    <input type="text" name="state_shipping" value="" size="33" maxlength="32" id="state_shipping" readonly="readonly">
    When I copy/paste from Firebug, it shows
    Code:
    value=""
    , but when I am viewing it in Firebug, it only shows
    Code:
    value size="33"
    . Not sure if that makes a difference.

    Any insight on why it isn't accepting my input value?

    Thanks
    Last edited by gump47371; 21 Oct 2012 at 11:00 AM.

  2. #2
    Join Date
    Jul 2010
    Posts
    27
    Plugin Contributions
    0

    Default Trouble making city+state fields readonly

    I use a Zen Cart site for a local, convenience-style delivery service. Because of this, I would like to make the city & state in the delivery(shipping) address readonly, with the fields already filled in. I posted this in another thread, but seemed to get buried.

    This is what I have so far. The city seems to autofill and readonly the field correctly, but the state, while it turns it to readonly OK, doesn't input the value I provide, or gets removed somehow. I have State dropdown disabled.

    City:

    Code:
    <label class="inputLabel" for="city_shipping"><?php echo ENTRY_CITY; ?></label>
    <?php echo zen_draw_input_field('city_shipping', 'City', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . ' id="city_shipping" readonly="readonly"') . (zen_not_null(ENTRY_CITY_TEXT) ? '<span class="alert">' . ENTRY_CITY_TEXT . '</span>': ''); ?>
    <br class="clearBoth" />
    State:

    Code:
    <?php
      if (ACCOUNT_STATE == 'true') {
        if ($flag_show_pulldown_states_shipping == true) {
    ?>
    <label class="inputLabel" for="stateZone_shipping" id="zoneLabel"><?php echo ENTRY_STATE; ?></label>
    <?php
          echo zen_draw_pull_down_menu('zone_id_shipping', zen_prepare_country_zones_pull_down($selected_country_shipping), $zone_id_shipping, 'id="stateZone_shipping"');
          if (zen_not_null(ENTRY_STATE_TEXT)) echo '##<span class="alert">' . ENTRY_STATE_TEXT . '</span>'; 
        }
    ?>
    
    <?php if ($flag_show_pulldown_states_shipping == true) { ?>
    <br class="clearBoth" id="stBreakShipping" />
    <?php } ?>
    <label class="inputLabel" for="state_shipping" id="stateLabelShipping"><?php echo $state_field_label_shipping; ?></label>
    <?php
        echo zen_draw_input_field('state_shipping', 'State', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state_shipping" readonly="readonly"');
        if (zen_not_null(ENTRY_STATE_TEXT)) echo '##<span class="alert" id="stTextShipping">' . ENTRY_STATE_TEXT . '</span>';
        if ($flag_show_pulldown_states_shipping == false) {
          echo zen_draw_hidden_field('zone_id_shipping', $zone_name_shipping, ' ');
        }
    ?>
    <br class="clearBoth" />
    <?php
      }
    ?>
    Further, when I inspect it with Firebug, I get:

    City:

    Code:
    <input type="text" name="city_shipping" value="City" size="33" maxlength="32" id="city_shipping" readonly="readonly">
    State:

    Code:
    <input type="text" name="state_shipping" value="" size="33" maxlength="32" id="state_shipping" readonly="readonly">
    When I copy/paste from Firebug, it shows
    Code:
    value=""
    , but when I am viewing it in Firebug, it only shows
    Code:
    value size="33"
    . Not sure if that makes a difference.

    Any insight on why it isn't accepting/keeping my input value?

    Thanks

  3. #3
    Join Date
    Jul 2010
    Posts
    27
    Plugin Contributions
    0

    Default Re: Trouble making city+state fields readonly

    Just wanted to bump this up to the frontpage once, hopefully someone can figure this out for me.

    As an alternative, is there a way to enter a default when the dropdown list of states load? That would be acceptable also.

 

 

Similar Threads

  1. Postcode, city, state customization
    By yokozuna in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 3 Jan 2012, 05:17 AM
  2. HELP, WA State, City Taxes and Local Sales Tax Mod
    By pulltabwarehouse in forum General Questions
    Replies: 1
    Last Post: 8 Oct 2010, 05:10 PM
  3. 10736 Shipping Address Invalid City State Postal
    By jwashburn in forum PayPal Express Checkout support
    Replies: 30
    Last Post: 6 Jan 2010, 11:13 PM
  4. State problem with new account (when making state field not required)
    By earmsby in forum Managing Customers and Orders
    Replies: 9
    Last Post: 13 May 2007, 10:04 PM
  5. tax based on city in same state
    By fairview in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 2
    Last Post: 20 Dec 2006, 09:33 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR