emmaluc Posted May 15, 2014 Share Posted May 15, 2014 Salut !J'utilise prestashop v.1.5.3 Je souhaiterai dans mon formulaire d'inscription pouvoir obliger les utilisateur à entrer 6 chiffres min. et max. dans le champ téléphone et mobile. J'ai trouvé ces 2 lignes dans mon fichier authentication.tpl : <p class="text"> <label for="phone">{l s='Home phone'}</label> <input type="text" class="text" name="phone" id="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{/if}" /> </p> <p class="text"> <label for="phone_mobile">{l s='Mobile phone'} {if $onr_phone_at_least}<sup>*</sup>{/if}</label> <input type="text" class="text" name="phone_mobile" id="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{/if}" /> </p> Est ce que quelqu'un pourrait m'aider à ajouter un substr pour ces 2 champs ? Merciiii !! Link to comment Share on other sites More sharing options...
coeos.pro Posted May 15, 2014 Share Posted May 15, 2014 si tu veux que les clients mettent 6 chiffres il vaut mieux s'orienter sur du js que du smarty Link to comment Share on other sites More sharing options...
emmaluc Posted May 15, 2014 Author Share Posted May 15, 2014 Est ce que tu pourrais m'aider à mettre en place le JS ? Link to comment Share on other sites More sharing options...
emmaluc Posted May 15, 2014 Author Share Posted May 15, 2014 Bon je répond à mon post car j'ai trouvé la solution. Dans le fichier AuthController.php dans le dossier Controllers, après la ligne : if (!Tools::getValue('phone') AND !Tools::getValue('phone_mobile')) Entrer : (pour le mobile) $digits_mobile = strlen(Tools::getValue('phone_mobile')); if (Tools::getValue('phone_mobile') AND $digits_mobile !=10) $this->errors[] = Tools::displayError('Please enter 8 digits for the mobile phone number.'); (pour le fixe) $digits_home = strlen(Tools::getValue('phone')); if (Tools::getValue('phone') AND $digits_home !=10) $this->errors[] = Tools::displayError('Please enter 8 digits for the home phone number.'); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now