[[+content_image]]
O
O
Otrivin2018-08-31 14:31:44
MODX
Otrivin, 2018-08-31 14:31:44

How to get input data in FormIt ModX?

Hello!
There is a site on ModX Revolution, with forms on FormIt.
After checking the entered data, it is necessary to transfer them to a custom snippet.
Added my hook to the form:

[[!FormIt?
  &hooks=`spam,email,myhook`
  &emailTpl=`tplForm`
  &emailTo=`[email protected]`
  &emailSubject=`Письмо с сайта http://askmeplz.com/`
  &successMessage=`Ваша заявка успешно отправлена!`
  &validate=`yournameer:required,yourphoneer:required`
]]

Created a "myhook" snippet (for now, just a stub, to check if it works)
<?php
$data = print_r($_POST, TRUE).PHP_EOL;

// сливаем массив $_POST в файл
$fp = fopen($_SERVER['DOCUMENT_ROOT']."/file.txt", "w");
fwrite($fp, $data);
fclose($fp);

return true;

However, when filling out the form "file.txt" is not created.
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
display: block, 2018-08-31
@Otrivin

Hook is working. Maybe spam hook or email fails? Or validation fails? Try putting myhook first in the queue.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question