Answer the question
In order to leave comments, you need to log in
Service Q&A in Modx Revo based on FormIt?
Hello everyone,
Tell me, please, on the old site, a service was organized for online answers to questions using eform, which does not work in Revo. It was organized as follows:
[!addQuestion!]
[!eForm? &from=`текст` &formid=`ContactForm` &subject=`поле темы` &to=`email` &tpl=`askForm` &report=`askReport` &thankyou=`231` &eFormOnBeforeMailSent=`CreateNewQuestion` &vericode=`1` !]
<?php
function CreateNewQuestion(&$fields){
// Массив $fields будет содержать данные всех полей формы
// Создания документа с описанием.
require_once('assets/libs/docmanager/document.class.inc.php');
$doc = new Document(); // создаем документ
$doc->Set('parent',5); // определяем в какую папку положить
$doc->Set('template','con'); // задаем шаблон
$doc->Set('pagetitle',"Вопрос специалисту: ".$fields['name']." ".date("d-m-Y")); // краткое название
$doc->Set('published',0);
$doc->Set('hidemenu',0);
$doc->Set('content',$fields['questions']);
$doc->Set('createdon',time());
$doc->Set('tvemail',$fields['e-mail']);
$doc->Set('tvautor',$fields['name']);
$wd_=date("w");
switch($wd_){
case '1': $wd='понедельник'; break;
case '2': $wd='вторник'; break;
case '3': $wd='среда'; break;
case '4': $wd='четверг'; break;
case '5': $wd='пятница'; break;
case '6': $wd='суббота'; break;
case '0': $wd='воскресенье'; break;
}
$time=date("d.m.Y").", ".date("H:i").", ".$wd;
$doc->Set('tvtime',$time);
$doc->Save(); // сохраняем
return true; // Говорим eForm, что все в порядке.
}
<form action="" method="post" class="form">
<table cellspacing="0" cellpadding="0" >
<input type="hidden" name="nospam" value="" />
<tr>
<td>
<label accesskey="s" for="name">
Ваше имя:
</label>
</td>
<td>
<input type="text" name="name" id="name" value="" />
</td>
</tr>
<tr>
<td>
<label for="email">
Ваш Email:
</label>
</td>
<td>
<input type="text" name="email" id="email" value="" />
</td>
</tr>
<tr>
<td>
<label for="questions">
Ваши вопрос:
<span class="error"></span>
</label>
</td>
<td>
<textarea name="questions" id="text" cols="55" rows="7" value=""></textarea>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<div class="form-buttons">
<input type="submit" value="Отправить вопрос" />
</div>
</td>
</tr>
</table>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question