FormIt не работает (Revo 3.0)

Can’t set up the contact form. I press the submit button and I get to the top of the page. Emails are not sent, and &redirectTo does not go to the page. What am I doing wrong?

[[!FormIt?
&hooks=`spam,email,redirect` 
&emailTpl=`email_tpl`
&emailTo=`mail@mydomen.com`
&emailSubject=`message from the site [[++site_url]]`
&redirectTo=`6`
&validate=`name:required,email:email:required,text:required:stripTags,phone:required`
]] 
[[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
  
<form action="[[~[[*id]]]]" method="post" class="form" id="form_input">
    <input type="hidden" name="nospam:blank" value="" />
 
    <label for="name">Name <span class="required">*</span>:</label><br/>
    <span class="error">[[!+fi.error.name]]</span>
    <input type="text" name="name" id="name" value="[[!+fi.name]]" /><br/>
 
    <label for="email">Email <span class="required">*</span>:</label><br/>
    <span class="error">[[!+fi.error.email]]</span>
    <input type="text" name="email" id="email" value="[[!+fi.email]]" /><br/>
  
    <label for="text">Message <span class="required">*</span>:</label><br/>
    <span class="error">[[!+fi.error.text]]</span>
    <textarea name="text" id="text" cols="55" rows="7" value="[[!+fi.text]]">[[!+fi.text]]</textarea><br/>
   
    <div id="mess_send" class="btn"><input class="submit_button" type="submit" value="Send" /></div>
</form>

There is a required field “phone” in &validate,

&validate=`..,phone:required`

but there is no input field for that in the form.

1 Like

Now I am getting this error
(ERROR @ /core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: modRestClient from rest.modrestclient
[2022-04-11 07:27:49] (ERROR @ /core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1267) Problem getting service rest, instance of class rest.modRestClient, from path

modRestClient has been removed in MODX3 (see Breaking Changes), but is still used in FormIt (in the current version) for the “spam” hook.

so what should i do to make it work?

Remove the spam hook - I don’t think that actually works anymore anyway. As long as that’s the only place using it in FormIt, that should get it working again at least. FormIt will need to be updated to resolve that fully.

modmore also has an Akismet integration if you get a lot of spam on the forms; that works much better than any other solution we tried.

1 Like

Thank you. It works!

1 Like