diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index f8575864b..6d6e449fa 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -43,8 +43,9 @@ class AddressControllerCore extends FrontController public function setMedia() { parent::setMedia(); - $this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js'); $this->addJS(_PS_JS_DIR_.'validate.js'); + $this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js'); + $this->addJS(_THEME_JS_DIR_.'validate_fields.js'); } /** diff --git a/themes/default-bootstrap/address.tpl b/themes/default-bootstrap/address.tpl index 908e6b4ef..dca74b6b7 100644 --- a/themes/default-bootstrap/address.tpl +++ b/themes/default-bootstrap/address.tpl @@ -114,41 +114,39 @@ $(function(){ldelim} {/if} {if $field_name eq 'firstname'}
- - -
- + + {/if} {if $field_name eq 'lastname'}
- +
{/if} {if $field_name eq 'address1'}
- +
{/if} {if $field_name eq 'address2'}
- +
{/if} {if $field_name eq 'postcode'} {assign var="postCodeExist" value="true"}
- +
{/if} {if $field_name eq 'city'}
- +
{* if customer hasn't update his layout address, country has to be verified @@ -200,8 +198,7 @@ $(function(){ldelim} {if $postCodeExist eq "false"}
- +
{/if} {if $stateExist eq "false"} @@ -214,12 +211,11 @@ $(function(){ldelim} {/if}
- +
- +
{if isset($one_phone_at_least) && $one_phone_at_least}

{l s='You must register at least one phone number.'}

@@ -227,11 +223,11 @@ $(function(){ldelim}
- +
- +

diff --git a/themes/default-bootstrap/js/validate_fields.js b/themes/default-bootstrap/js/validate_fields.js new file mode 100644 index 000000000..446382cad --- /dev/null +++ b/themes/default-bootstrap/js/validate_fields.js @@ -0,0 +1,35 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +$(document).ready(function() { + $('input.validate, textarea.validate').keyup(function() { + if ($(this).hasClass('is_required') || $(this).val().length) + { + if (window['validate_'+$(this).attr('data-validate')]($(this).val())) + $(this).parent().removeClass('form-error').addClass('form-ok'); + else + $(this).parent().addClass('form-error').removeClass('form-ok'); + } + }); +});