Nom et Prenom passé en required

This commit is contained in:
Valentin 2017-06-20 21:27:38 +02:00
parent 820e080976
commit 11b9f278c0
2 changed files with 12 additions and 12 deletions

View File

@ -25,14 +25,14 @@ class addCustomerFormModuleFrontController extends ModuleFrontController
private function processRequest()
{
if (Tools::getValue('lastName')) {
if (!Validate::isName(Tools::getValue('lastName'))) {
$this->errors = Tools::displayError('Veuillez renseigner un nom correct');
}
} elseif (Tools::getValue('firstName')) {
if (!Validate::isName(Tools::getValue('firstName'))) {
$this->errors = Tools::displayError('Veuillez renseigner un prenom correct');
}
if (!Tools::getValue('lastName')) {
$this->errors = Tools::displayError('Un nom est requis');
} elseif (!Validate::isName(Tools::getValue('lastName'))) {
$this->errors = Tools::displayError('Veuillez renseigner un nom correct');
} elseif (!Tools::getValue('firstName')) {
$this->errors = Tools::displayError('Un nom est requis');
} elseif (!Validate::isName(Tools::getValue('firstName'))) {
$this->errors = Tools::displayError('Veuillez renseigner un prenom correct');
} elseif (!Tools::getValue('phoneNumber')) {
$this->errors = Tools::displayError('Un numéro est requis');
} elseif (!Validate::isPhoneNumber(Tools::getValue('phoneNumber'))) {

View File

@ -15,12 +15,12 @@
<div class="alert alert-danger displayError" style="margin-bottom: 20px;">{$errors}</div>
{/if}
<div class="form-group">
<label for="lastName">{l s='Nom' mod='addcustomer'}</label>
<input type="text" name="lastName" class="account_input form-control" {if (isset($smarty.post.lastName))} value="{$smarty.post.lastName}"{/if}>
<label for="lastName">{l s='Nom' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="lastName" class="account_input form-control" {if (isset($smarty.post.lastName))} value="{$smarty.post.lastName}"{/if}>
</div>
<div class="form-group">
<label for="firstName">{l s='Prenom' mod='addcustomer'}</label>
<input type="text" name="firstName" class="account_input form-control" {if (isset($smarty.post.firstName))} value="{$smarty.post.firstName}"{/if}>
<label for="firstName">{l s='Prenom' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="firstName" class="account_input form-control" {if (isset($smarty.post.firstName))} value="{$smarty.post.firstName}"{/if}>
</div>
<div class="form-group">
<label for="phoneNumber">{l s='Numéro de téléphone' mod='addcustomer'} <sup>*</sup></label>