Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Required. Please select your country.

    I am trying to display "Required. Please select your country.", or more simply "Required.", as a placeholder in the Country dropdown box of the Create Account form in an effort to help reduce errors pre-validation, but to no avail.

    Code:
    <label class="inputLabel" for="country"><?php echo ENTRY_COUNTRY . '<span class="reqd">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
    <?php echo zen_get_country_list('zone_country_id', $selected_country, 'id="country" title="' . ENTRY_COUNTRY_TEXT . '" placeholder="' . ENTRY_COUNTRY_TEXT . '" required' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')); ?>
    wrt the colour highlighting above, green works, but red and orange seem to have no affect.



    Now I have the desired text defined in two places in \151\includes\languages\MyTemplate\english.php

    Code:
      define('ENTRY_COUNTRY_TEXT', 'Required. Please select your Country');
    and
    Code:
      define('PULL_DOWN_DEFAULT', 'Required. Please select your country');
    where the latter puts the required text at the top of the dropdown, as per includes\functions\html_output.php, ie

    Code:
    /*
     * Creates a pull-down list of countries
     */
      function zen_get_country_list($name, $selected = '', $parameters = '') {
        $countriesAtTopOfList = array();
        $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
        $countries = zen_get_countries();
    
        // Set some default entries at top of list:
        if (STORE_COUNTRY != SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY) $countriesAtTopOfList[] = SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
        $countriesAtTopOfList[] = STORE_COUNTRY;
        // IF YOU WANT TO ADD MORE DEFAULTS TO THE TOP OF THIS LIST, SIMPLY ENTER THEIR NUMBERS HERE.
        // Duplicate more lines as needed
        // Example: Canada is 108, so use 108 as shown:
        //$countriesAtTopOfList[] = 108;
    
        //process array of top-of-list entries:
        foreach ($countriesAtTopOfList as $key=>$val) {
          $countries_array[] = array('id' => $val, 'text' => zen_get_country_name($val));
        }
        // now add anything not in the defaults list:
        for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
          $alreadyInList = FALSE;
          foreach($countriesAtTopOfList as $key=>$val) {
            if ($countries[$i]['countries_id'] == $val)
            {
              // If you don't want to exclude entries already at the top of the list, comment out this next line:
              $alreadyInList = TRUE;
              continue;
            }
          }
          if (!$alreadyInList) $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
        }
    
        return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
      }


    As a comparison, I can display "Please select or type your State below" within the State dropdown box of the Create Account form, which is defined in \151\includes\languages\MyTemplate\english.php as:

    Code:
      define('TYPE_BELOW', 'Please select or type your State below ...');
    However, this text is inserted by includes\functions\functions_general.php, ie

    Code:
    /**
     * return an array with country names and matching zones to be used in pulldown menus
     */
      function zen_prepare_country_zones_pull_down($country_id = '') {
    // preset the width of the drop-down for Netscape
        $pre = '';
        if ( (!zen_browser_detect('MSIE')) && (zen_browser_detect('Mozilla/4')) ) {
          for ($i=0; $i<45; $i++) $pre .= '&nbsp;';
        }
    
        $zones = zen_get_country_zones($country_id);
    
        if (sizeof($zones) > 0) {
          $zones_select = array(array('id' => '', 'text' => PLEASE_SELECT));
          $zones = array_merge($zones_select, $zones);
        } else {
          $zones = array(array('id' => '', 'text' => TYPE_BELOW));
    // create dummy options for Netscape to preset the height of the drop-down
          if ( (!zen_browser_detect('MSIE')) && (zen_browser_detect('Mozilla/4')) ) {
            for ($i=0; $i<9; $i++) {
              $zones[] = array('id' => '', 'text' => $pre);
            }
          }
        }
    
        return $zones;
      }
    PLEASE_SELECT is also defined in \151\includes\languages\MyTemplate\english.php as
    Code:
      define('PLEASE_SELECT', 'Please select ...');


    Help greatly appreciated.

  2. #2
    Join Date
    Sep 2008
    Posts
    210
    Plugin Contributions
    21

    Default Re: Required. Please select your country.

    I dont think the drop down list can works with placeholder. You have to change the languages for the drop down list.
    Our Site: http://zucando.com
    Marketing Plugins: Marketing Modules
    Free Response Templates: Responsive Templates

  3. #3
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default Re: Required. Please select your country.

    Thanks. Yes I know placeholders per se do not work with dropdowns, so what I am trying to do is emulate the way text is inserted into the State field.

    My other question is how can the State text be styled. ATM the State text is rendered black, but I want it to display grey (ie color:#666;).

 

 

Similar Threads

  1. Please select a payment method for your order
    By jensen_tw in forum PayPal Express Checkout support
    Replies: 22
    Last Post: 11 Feb 2020, 11:41 AM
  2. v151 Your available shipping options have changed. Please re-select your desired shipping
    By sgallasch in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 28 Jan 2019, 10:36 PM
  3. Please select a payment method for your order
    By ellivir in forum PayPal Express Checkout support
    Replies: 6
    Last Post: 18 Nov 2010, 09:21 PM
  4. Please select a payment method for your order
    By stagebrace in forum Bug Reports
    Replies: 1
    Last Post: 3 Jun 2010, 10:50 AM
  5. * Please select a payment method for your order.
    By scott_see in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 22 Jan 2010, 01:03 AM

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