add hidden inputs in form
This commit is contained in:
25
partials/formhash.php
Executable file
25
partials/formhash.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?$addrhash = adddr_hash();
|
||||
if ($addrhash !== null):?>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
let form = document.getElementById('form-right');
|
||||
let inputAdded = false;
|
||||
|
||||
form.addEventListener('mouseenter', function() {
|
||||
|
||||
if (!inputAdded) {
|
||||
|
||||
var hiddenInput = document.createElement("input");
|
||||
hiddenInput.type = "hidden";
|
||||
hiddenInput.name = "addrhash"; // имя поля
|
||||
hiddenInput.value = "<?=$addrhash?>"; // значение поля
|
||||
|
||||
form.appendChild(hiddenInput);
|
||||
inputAdded = true;
|
||||
|
||||
}
|
||||
}, { once: true });
|
||||
});
|
||||
</script>
|
||||
<?endif;?>
|
||||
@@ -2,14 +2,10 @@
|
||||
<div id="convert"></div>
|
||||
<div class="right_title"><?=vij_lang('email_title', LANG_VERSION);?></div>
|
||||
<div id="subscript-mail">
|
||||
<form class="form-right" action="https://vetandlife.ru/subscript" method="post">
|
||||
<form class="form-right" id="form-right" action="https://vetandlife.ru/subscript" method="post">
|
||||
<input сlass="frm_mail" type="email" required name="email" placeholder="<?=vij_lang('your_mail', LANG_VERSION);?>">
|
||||
<?php wp_nonce_field('subscription_form_nonce', 'subscription_nonce'); ?>
|
||||
<?$addr = adddr_hash();
|
||||
if ($addr !== null):?>
|
||||
<input type="hidden" name="addrr" value="<?=$addr?>">
|
||||
<?endif?>
|
||||
<input type="hidden" name="sender" value="info@vetandlife.ru">
|
||||
<input type="text" class="mytext" name="mytext" placeholder="Дополнительный текст">
|
||||
<button class="frm_submit"><?=vij_lang('email_btn', LANG_VERSION);?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user