Add invisible field

This commit is contained in:
Michael RICOIS 2017-12-13 11:29:56 +01:00
parent d77173316f
commit e5f83c46b4
2 changed files with 9 additions and 3 deletions

View File

@ -56,7 +56,10 @@ class ContactController extends ContactControllerCore {
$fileAttachment['mime'] = $_FILES['fileUpload']['type']; $fileAttachment['mime'] = $_FILES['fileUpload']['type'];
} }
$message = Tools::htmlentitiesUTF8(Tools::getValue('message')); $message = Tools::htmlentitiesUTF8(Tools::getValue('message'));
if (!($from = trim(Tools::getValue('from'))) OR !Validate::isEmail($from)){ if (Tools::getValue('email2') != '') {
$this->errors[] = Tools::displayError('Invalid e-mail address');
}
elseif (!($from = trim(Tools::getValue('from'))) OR !Validate::isEmail($from)){
$this->errors[] = Tools::displayError('Invalid e-mail address'); $this->errors[] = Tools::displayError('Invalid e-mail address');
} }
elseif ($alert_mode AND Suspect::isBannished($from)){ elseif ($alert_mode AND Suspect::isBannished($from)){

View File

@ -73,10 +73,12 @@
<label for="email">{l s='E-mail address'}</label> <label for="email">{l s='E-mail address'}</label>
{if isset($customerThread.email)} {if isset($customerThread.email)}
<input type="text" id="email" name="from" value="{$customerThread.email}" readonly="readonly" /> <input type="text" id="email" name="from" value="{$customerThread.email}" readonly="readonly" />
<input type="text" id="email2" name="email2" value="{$customerThread.email}" />
{else} {else}
<input type="text" id="email" name="from" value="{$email}" /> <input type="text" id="email" name="from" value="{$email}" />
{/if} <input type="text" id="email2" name="email2" value="{$email}" />
</p> {/if}
</p>
{if !$PS_CATALOG_MODE} {if !$PS_CATALOG_MODE}
{*{if (!isset($customerThread.id_order) || $customerThread.id_order > 0)} {*{if (!isset($customerThread.id_order) || $customerThread.id_order > 0)}
<p class="text"> <p class="text">
@ -137,6 +139,7 @@
{literal} {literal}
<script> <script>
$(function() { $(function() {
$('input#email2').val('').hide();
if($("option:selected", $('#id_contact')).val() == 9 || $("option:selected", $('#id_contact')).val() == 1 || $("option:selected", $('#id_contact')).val() == 2){ if($("option:selected", $('#id_contact')).val() == 9 || $("option:selected", $('#id_contact')).val() == 1 || $("option:selected", $('#id_contact')).val() == 2){
$('.overlay_bbb').fadeIn(); $('.overlay_bbb').fadeIn();
$('.box_waiting').fadeIn(); $('.box_waiting').fadeIn();