Add checking for email address if email checkbox is checked. #408

This commit is contained in:
Korina Cordero 2020-05-15 09:24:31 +00:00
parent af85a632e5
commit bbebdb04c8
2 changed files with 20 additions and 0 deletions

View file

@ -177,6 +177,15 @@ class ResqCustomerHandler implements CustomerHandlerInterface
if (!$is_dpa_checked)
$error_array['flag_dpa_consent'] = 'DPA consent should be checked.';
// check if email marketing promo is checked
$is_email_promo_checked = $req->request->get('flag_promo_email');
if ($is_email_promo_checked)
{
// check email field
if (empty($req->request->get('email')))
$error_array['email'] = 'Email address required.';
}
$this->setObject($row, $req);
// custom validation for vehicles
@ -335,6 +344,16 @@ class ResqCustomerHandler implements CustomerHandlerInterface
if (!$is_dpa_checked)
$error_array['flag_dpa_consent'] = 'DPA consent should be checked.';
// check if email marketing promo is checked
$is_email_promo_checked = $req->request->get('flag_promo_email');
if ($is_email_promo_checked)
{
// check email field
if (empty($req->request->get('email')))
$error_array['email'] = 'Email address required.';
}
// TODO: validate mobile numbers
// TODO: validate vehicles

View file

@ -80,6 +80,7 @@
E-mail
</label>
<input type="text" name="email" class="form-control m-input" value="{{ obj.getEmail }}" data-name="email">
<div class="form-control-feedback hide" data-field="email"></div>
</div>
</div>
<div class="form-group m-form__group row">