MODX Community

Formit Redirect and Snippet

Hello,
i recently had a problem with the package “Formit 4.2.5-pl” on Revolution. After submitting the form I try to execute a redirect and then start a snippet. In the meantime I have reduced the form completely and my snippet is also completely empty. Nevertheless no redirect works after submitting the form. Does anyone have an idea?

[[!FormIt? 
&hooks=`email, redirect, db-info` 
&emailTpl=`emailtpl` 
&redirectTo=`[[!++site_url]][[~7]]`
&emailTo=`test@.....de`


]]
<h3>Anfrage</h3>
<form id="contactForm" class="cmxform" method="post">
<input name="contact_name">
<input name="contact_nachname"> 
<input type="submit" value="Anfrage verschicken"> 
</form>

emailtpl Chunk:
Name: [[+contact_name]]

Nachname: [[+contact_nachname]]

db-info Snippet:
<?php
return;

Hi @joe-petts,

According to the official formIt documentation, the redirectTo field should only contain the resource ID:
https://docs.modx.com/current/en/extras/formit/formit.hooks/redirect

So this is how your formit call concerning redirectTo should look like:

&redirectTo=`7`

Cheers

The link at the redirect was not the problem here. It was because a snippet used with Formit must end with “reuturn true;” and not “return;”.

But thanks for the support anyway!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.