A
A
adam_carraway2019-05-17 15:10:06
MODX
adam_carraway, 2019-05-17 15:10:06

Hook why does not work?

There is a form that is in a chunk

[[!AjaxForm?
        &snippet=`FormIt`
        &form=`callbackTpl`
        &hooks=`email,FormItSaveForm,spam`
        &emailTpl=`emailTpl`
        &emailTo=[[++adminMail]]
        &validate=`phone:required,name:required,email:blank`
        &validationErrorMessage=`В форме содержатся ошибки!`
        &successMessage=`Ваша заявка в работе`
        &emailSubject=`Обратный звонок`
        &emailFrom=`[email protected]`
    ]]

I created a new snippet at the root of the
5cdea3af293b7578458048.png
customhook content
<?php
  $to = "[email protected]";
  $subject = "Robot - Робот";
  $message = "Message, сообщение!";
  mail ($to, $subject, $message);

Then I added the snippet title to the form hook
[[!AjaxForm?
        &snippet=`FormIt`
        &form=`callbackTpl`
        &hooks=`email,FormItSaveForm,spam,customhook`
        &emailTpl=`emailTpl`
        &emailTo=[[++adminMail]]
        &validate=`phone:required,name:required,email:blank`
        &validationErrorMessage=`В форме содержатся ошибки!`
        &successMessage=`Ваша заявка в работе`
        &emailSubject=`Обратный звонок`
        &emailFrom=`[email protected]`
    ]]

I want that after the form is sent, an SMS is sent to the mail. But for some reason nothing works, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Sanes, 2019-05-17
@adam_carraway

Try changing the order. Spam is sure to be first. FormItSaveForm seemed to somehow affect email before, if the order is different.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question