S
S
Sinner32016-07-29 14:23:52
1C-Bitrix
Sinner3, 2016-07-29 14:23:52

How to pass "link of current page+title" to Mail template for web form?

There is a web form with two fields (callback order), it is displayed on pages with equipment. Is it necessary to send the address of the page and the title on which the form was filled out in the mail message so that the manager understands from which page the request came from?
For example, I can create a variable with a value in a web form template, but how can I pass it to the template?
$page = $APPLICATION->GetCurPage();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sinner3, 2016-08-03
@Sinner3

This solution ended up working.

<div class="reply ">
  <div class="row">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> 
      <!--вывод сообщений и ошибок-->
      <?=$FORM->ShowFormErrors()?>
      <?=$FORM->ShowFormNote()?>
    </div>
  </div>
  <div class="row ">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 form">
    	<!--подя для ввода-->
    <?=$FORM->ShowInput('email')?>
    <?=$FORM->ShowInput('tel')?>
    </div>
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
      <div class="button-form-sent">
    <!--кнопка отправить-->
        <?=$FORM->ShowSubmitButton("Получить","")?>
      </div>
    </div>
  </div>
</div>
<!--скрытая форма для хранения адреса страницы-->
<span>
<?=$FORM->ShowInput('hidenform')?>
</span> 

<script>
<!--Замена value в элементах ввода на placeholder-->
$('.form>input').each(function(){
   var value = $(this).val();
   $(this).removeAttr('value');
   $(this).attr('placeholder', value);
});

<!--получаем адрес страницы-->
var url = window.location.href;
<!--находим нужный элемент-->
var el = document.querySelector("span input");
<!--меняем значение value на адрес-->
el.setAttribute("value", url);
</script>  
<div></div>

A
Alexey Trofimov, 2016-07-29
@4yvi

The first thing that came to my mind was to write a handler in init.php or add a hidden input for the field and shove your values ​​there)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question