[[+content_image]]
D
D
danil_linkins2017-09-07 19:06:24
PHP
danil_linkins, 2017-09-07 19:06:24

Multiple form submission on one page FormIl MODx?

Good afternoon, I'm trying to get the forms working on one page, for the uniqueness of the forms I use submitVar.
This chunk is called directly in the template:
[[!AjaxForm?
&snippet=`FormIt`
&form=`tpl-popup`
&hooks=`email,order_to_amo`
&emailSubject=`Free Lesson Request!`
&emailTpl=`EmailTpl-popup`
&emailTo=`[[$email_to]]`
&emailFrom=`[[ $email_from]]`
&submitVar=`submit-
1` &ClientName=`name`
&ClientPhone=`phone`
&ClientEmail=``
&validate=`phone:required`
&validationErrorMessage=`The form contains errors!`
&successMessage=`Thank you for submitting your submission.
]]
The form itself:

<div class="popup">
    <img src="/assets/images/close.png">
    <form method="POST" action="">
      <div class='block'>
        <input type="hidden" name="typeform" value="Всплывающее окно">
        <input required type="text" class="name" name="name" placeholder="Ваше имя">
        <input required class='phone' type="text" name="phone" class="phone" placeholder="Ваш телефон">
        <input type="hidden" name="submit-popup" value="1">
      </div>
      [[+utms_fields]]
      <div class='block'>
        <button type='submit' name="submit-1">Записаться</button>
      </div>	
  </form>
</div>

And the email template:
<h1>Заявка с сайта [[!SERVER? &key=`HTTP_HOST`]]</h1>

Пользователь оставил заявку на обратны звонок

<br/>
<br/>
<b>Имя:</b> [[+name]]
<b>Телефон:</b> [[+phone]]
<br />
<br />

Страница на которой находится посетитель: <a href="[[+link]]">[[+link]]</a><br />
Адрес веб сайта с которого пришел  посетитель:<a href="[[+referer]]">[[+referer]]</a><br />
IP - адрес: [[!SERVER? &key=`REMOTE_ADDR`]]<br />
Дата: [[!date? &format=`d.m.Y H:i`]]


The fact is that there are 6 forms on the page, and therefore a letter from one comes 6 times, I tried to fix this using submitVar, but letters do not leave with it at all.
Help to understand please.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
F
Froggyweb, 2017-09-07
@Froggyweb

on ajaxform remove submitVar and pay attention to the form classes. a hidden field for the form indicator should be added. as far as I remember it is done in js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question