Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

State Selector for BS


raiwa

Recommended Posts

@helenium7

9 minutes ago, helenium7 said:

Might be of use to someone else, I could not get the  v2.4.4 to configure and got a database error when I tried to install but 2.3.3. seems to function OK. It was the lines starting   tep_db_query("insert into cconfiguration . . . 

which gave the problem whereas the previous was    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title . . . Not sure if its that double "cc" or is that a php 7 issue? - I am running 5.6 currently

Yes, it's the double 'c' that is causing the problem. The current coding style is getting away from having the TABLE_ declaration, and actually using the table name. Here, it's supposed to be "configuration". So, just delete the extra 'c'.

Malcolm

Link to comment
Share on other sites

  • 1 month later...

Great addon (contribution) I installed it on a 2.3.4.1 store, and in admin, I ticked that it should show up on account_pwa.php, but it isn't. It looks fine on checkout_shipping_address.php (state drop down and shop country is default) but not on account_pwa.php.

Does anyone know if there is a known issue with PWA for 2.3.4 and this contribution?

Link to comment
Share on other sites

Hello,

Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ?

regards

Rainer

Link to comment
Share on other sites

9 hours ago, raiwa said:

Hello,

Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ?

regards

Rainer

No, I must have misunderstood your post on page 1 of this thread, I thought you were saying something different. Thanks for your time and work on this addon.

Link to comment
Share on other sites

On 5/28/2015 at 2:48 AM, raiwa said:

If you wish you can move the country part below the state selector, it will work. But then I would recommend to add some text like "The "State" drop-down list will be updated when you change the Country".

 

regards

Rainer

 

Can you clarify this a little? In the US,  I need it to be, in order, city, state, post code, country, not city, post code, country, state.

I haven't tried re-arranging it myself, can I do it without messing up the drop down menus, or am I misunderstanding something again?

Usually when I try to just rearrange the code, I get errors, and since I am now building 2.3.4.1 BS, I don't want to mess with the code like I used to with 2.2, can you point out what to rearrange without causing errors, please?

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

just keep the integrity of these 2 blocks and move the complete country block, below the state block.

Country block:

    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) {
          $country = STORE_COUNTRY;
        }
        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>

 

State block:

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div id="results" class="col-sm-9">
        <?php
        $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
        $check = tep_db_fetch_array($check_query);
        $entry_state_has_zones = ($check['total'] > 0);
      
        if ($entry_state_has_zones == true) {
          $zones_array = array();
          $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);                        
          $zones_query = tep_db_query("select zone_name from zones where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
            	$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, '', 'required aria-required="true" id="inputState"');
            echo FORM_REQUIRED_INPUT;
        } else {
          echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE    . '"');
          echo FORM_REQUIRED_INPUT;
        }
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
  </div>

 

Link to comment
Share on other sites

@brian_cee

1 hour ago, brian_cee said:

Can you clarify this a little? In the US,  I need it to be, in order, city, state, post code, country, not city, post code, country, state.

What I think @raiwa was saying is ... if your customer starts to fill out the form, the State drop-down will list only the States for the default Country. If your customer is in another Country, they will not be able to select the correct State *UNTIL* they select their Country. *THEN*, the State field will refresh (and I *think* it will defaulting to the first State available for that country). Your customer will then have to go back and select the correct State.

So, @raiwa suggested that you add a bit of text telling your customer that they will have to re-select their State if they change their Country.

Make sense?

Now, I recognize that you want the fields on a specific order. Have you ever been on a web site where the Country is the first field in the form? There are some benefits to this, as you can not only have the correct States available in that drop-down field, but you can also format the rest of the form according to the addressing requirements of the customer's Country.

HTH

Malcolm

Link to comment
Share on other sites

4 hours ago, ArtcoInc said:

@brian_cee

What I think @raiwa was saying is ... if your customer starts to fill out the form, the State drop-down will list only the States for the default Country. If your customer is in another Country, they will not be able to select the correct State *UNTIL* they select their Country. *THEN*, the State field will refresh (and I *think* it will defaulting to the first State available for that country). Your customer will then have to go back and select the correct State.

So, @raiwa suggested that you add a bit of text telling your customer that they will have to re-select their State if they change their Country.

 

Oh, I see, I didn't think of that since I only ship within the USA, so I'll either remove the country field altogether, or leave it as the default and remove all other countries in the db as raiwa suggested years ago in this thread.......

Link to comment
Share on other sites

5 hours ago, raiwa said:

just keep the integrity of these 2 blocks and move the complete country block, below the state block.

 


    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) {
          $country = STORE_COUNTRY;
        }
        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div id="results" class="col-sm-9">
        <?php
        $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
        $check = tep_db_fetch_array($check_query);
        $entry_state_has_zones = ($check['total'] > 0);
      
        if ($entry_state_has_zones == true) {
          $zones_array = array();
          $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);                        
          $zones_query = tep_db_query("select zone_name from zones where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
            	$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, '', 'required aria-required="true" id="inputState"');
            echo FORM_REQUIRED_INPUT;
        } else {
          echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" required aria-required="true" placeholder="' . ENTRY_STATE    . '"');
          echo FORM_REQUIRED_INPUT;
        }
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
  </div>

 

Thanks for taking the time to do that, that's exactly what I was looking for.........

Link to comment
Share on other sites

Unfortunately, every time I move the state block above the country block, the state field loses the drop down menu and becomes just another entry field again. It's not just a matter of adding an explanation to customers......And I tried just deleting the country block since I only ship within the USA, but it's required, so I can't proceed in the checkout unless I selectt a country that isn't there.......

Link to comment
Share on other sites

On 1/30/2018 at 2:18 AM, raiwa said:

Hello,

Did you apply the modifications for create_account.php as described in the installation also to account_pwa.php ?

regards

Rainer

Hey, I had done that and everything went smoothly, but afterwards I uninstalled that version of PWA and installed the newer one with the reviews function (PWA for BS 2.5R1).....then when I tried to ad the state selector changes to that version of account_pwa, it stripped away the left and right columns and put the best seller box underneath the address fields and stuff, on shop/account_pwa.php...........

I tried comparing differences between the older version of account_pwa.php and the newer one, to see how I could make the install fit, but I can't figure it out.

 

It's something in these instructions that breaks that page up when uploaded:

 

3. catalog/create_account.php (or account_pwa.php)

FIND:

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div class="col-sm-9">
        <?php
        if ($process == true) {
          if ($entry_state_has_zones == true) {
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState" aria-describedby="atState"');
            echo FORM_REQUIRED_INPUT;
            if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>';
          } else {
            echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');
            echo FORM_REQUIRED_INPUT;
          }
        } else {
          echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');
          echo FORM_REQUIRED_INPUT;
        }
        ?>
      </div>
    </div>
<?php
  }
?>
    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        echo tep_get_country_list('country', NULL, 'required aria-required="true" aria-describedby="atCountry" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>
  </div>

REPLACE WITH:

    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) {
          $country = STORE_COUNTRY;
        }
        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>
    
<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div class="col-sm-9">
        <?php
        $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
        $check = tep_db_fetch_array($check_query);
        $entry_state_has_zones = ($check['total'] > 0);
      
        if ($entry_state_has_zones == true) {
          $zones_array = array();
          $zones_array[0] = array('id' => '0', 'text' => PULL_DOWN_DEFAULT);                        
          $zones_query = tep_db_query("select zone_name from zones where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
                $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo '<span id="results">';
            echo tep_draw_pull_down_menu('state', $zones_array, '', 'id="inputState"');
            echo '</span>';
            echo FORM_REQUIRED_INPUT;
        } else {
          echo '<span id="results">';
          echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE    . '"');
          echo '</span>';
          echo FORM_REQUIRED_INPUT;
        }
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
  </div>

 

Is my issue related to this code, do you think, or did I go wrong elsewhere?

Link to comment
Share on other sites

Followup: Since those files aren't identical, I replace this in my version of PWA's account_pwa.php:

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div class="col-sm-9">
        <?php
        if ($process == true) {
          if ($entry_state_has_zones == true) {
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState" aria-describedby="atState"');
            echo FORM_REQUIRED_INPUT;
            if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>';
          } else {
            echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');
            echo FORM_REQUIRED_INPUT;
          }
        } else {
          echo tep_draw_input_field('state', NULL, 'id="inputState" placeholder="' . ENTRY_STATE_TEXT . '"');
          echo FORM_REQUIRED_INPUT;
        }
        ?>
      </div>
    </div>
<?php
  }
?>
    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        echo tep_get_country_list('country', NULL, 'required aria-required="true" aria-describedby="atCountry" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>

 

I REPLACE THIS WITH:

<div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        if ( !isset($country) && MODULE_HEADER_TAGS_GET_STATES_DEFAULT_COUNTRY == 'True' ) {
          $country = STORE_COUNTRY;
        }
        echo tep_get_country_list('country', $country, 'onChange="getState(this.value)" required aria-required="true" id="inputCountry"');
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div id="results" class="col-sm-9">
        <?php
        $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
        $check = tep_db_fetch_array($check_query);
        $entry_state_has_zones = ($check['total'] > 0);
      
        if ($entry_state_has_zones == true) {
          $zones_array = array();
          $zones_array[0] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);                        
          $zones_query = tep_db_query("select zone_name from zones where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
                $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, '', 'id="inputState"');
        } else {
          echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" placeholder="' . ENTRY_STATE . '"');
        }
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
    </div>

 

Edited by brian_cee
add info
Link to comment
Share on other sites

Hello Brian,

If this happens your

<div>

...

</div>

tags are unbalanced. This means there is one missing or one left over.

Try to remove the last one in the code snippet you posted:

....
          echo tep_draw_input_field('state', NULL, 'id="inputState" class="form-control" placeholder="' . ENTRY_STATE . '"');
        }
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
    </div> 

 

Link to comment
Share on other sites

  • 2 weeks later...

Hey, I recently started a fresh install of the store and ran the update scripts on the old OS2.2 database so it works with 2.3.4bs.....Now I'm re-adding the addons I've tested, and everything is going good except this state selector......I followed all of the install directions, and there are no errors, and the default country is auto-selected and everything, but there is no state dropdown, it's still just a field that has to be typed in, which I don't understand. I uninstalled and reverted back to backed up files, did it all again, same result....I have a zone table in the db and it is populated with states, is there something obvious I might have messed up that would cause the dropdown function to not work?

Link to comment
Share on other sites

And on page one of this thread, @raiwa told someone else if they only ship to the store country, this addon can be uninstalled and just code on one page (create_account or, in my case, account_pwa) can be changed. When I do that, the state field has what looks like a drop down arrow, as if you might be able to see states drop down, but the arrow produces no results when clicked.

Any ideas appreciated.

Link to comment
Share on other sites

Hello Brian @brian_cee,

There are several ways to do this. You can find info and hints in the following thread:

https://www.oscommerce.com/forums/topic/412513-set-default-country-for-customers

One easy way would be to set your store country as default for the zone query, simplify the zone block to show always the menu. Then set the store country as default selected in the countries menu and disable the countries menu:

<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div class="col-sm-9">
        <?php
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_COUNTRY . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState" aria-describedby="atState"');
            echo FORM_REQUIRED_INPUT;
            if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span id="atState" class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>
<?php
  }
?>
    <div class="form-group has-feedback">
      <label for="inputCountry" class="control-label col-sm-3"><?php echo ENTRY_COUNTRY; ?></label>
      <div class="col-sm-9">
        <?php
        echo tep_get_country_list('country', STORE_COUNTRY, 'required disabled aria-required="true" aria-describedby="atCountry" id="inputCountry"');
        echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_COUNTRY_TEXT)) echo '<span id="atCountry" class="help-block">' . ENTRY_COUNTRY_TEXT . '</span>';
        ?>
      </div>
    </div>
  </div>

 

Link to comment
Share on other sites

  • 2 months later...
On 11/29/2017 at 7:38 PM, Bobber said:

This Worked Perfectly For Me @raiwa!

I only had to replace the old code with this below:


<?php
  if (ACCOUNT_STATE == 'true') {
?>
    <div class="form-group has-feedback">
      <label for="inputState" class="control-label col-sm-3"><?php echo ENTRY_STATE; ?></label>
      <div class="col-sm-9">
        <?php
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_COUNTRY . "' order by zone_name desc");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 0, 'id="inputState"');
            echo FORM_REQUIRED_INPUT;
        if (tep_not_null(ENTRY_STATE_TEXT)) echo '<span class="help-block">' . ENTRY_STATE_TEXT . '</span>';
        ?>
      </div>
    </div>

Thank you for your contribution with this code!

I have since update the code and found this to be the best solution for my application:

<?php
  if (ACCOUNT_STATE == 'true') {
?>

      <tr>
        <td class="fieldKey"><?php echo ENTRY_STATE; ?></td>
        <td class="fieldValue">
        <?php
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_COUNTRY . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 1, 'id="inputState"');

    if (tep_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>';
?>
        </td>
      </tr>

I hope this helps others looking for a solution!

Link to comment
Share on other sites

1 hour ago, Bobber said:

I have since update the code and found this to be the best solution for my application:


<?php
  if (ACCOUNT_STATE == 'true') {
?>

      <tr>
        <td class="fieldKey"><?php echo ENTRY_STATE; ?></td>
        <td class="fieldValue">
        <?php
            $zones_array = array();
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . STORE_COUNTRY . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }
            echo tep_draw_pull_down_menu('state', $zones_array, 1, 'id="inputState"');

    if (tep_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>';
?>
        </td>
      </tr>

I hope this helps others looking for a solution!

@Bobber, your application seems to be for 2.3.4 standard. You should explain this to avoid confusion.

This state selector version is for BS responsive. there are older add-ons available for 2.3.4 standard.

Link to comment
Share on other sites

  • 5 months later...

Hi,
thanks for this great contribution.

Has anybody tried to translate the standard browser error message 'Please fill out this field'?
The language of the message seems be the same as the browser language.

This is what I did.

in includes/functions/html_output.php and in the function  tep_draw_input_field

check if the 'required' is in the parameters:

..
    if (tep_not_null($parameters)) {
        if (strpos($parameters, 'required') !== false) {
           $parameters .= ' oninvalid="this.setCustomValidity(\'' . FORM_INPUT_VALUE_MISSING. '!\')" onchange="this.setCustomValidity(\'\')"';
        }
        $field .= ' ' . $parameters;
    }
..

in includes/languages/english.php
add

//customized form input error message
define('FORM_INPUT_VALUE_MISSING','This field is required');

in includes/languages/finnish.php
//customizedform input error messages
define('FORM_INPUT_VALUE_MISSING','Tämä on pakollinen tieto');

This seems to work both in latest Firefox and Chromium.

Any comments?

Edited by vmn
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...