<![CDATA[ Modx FormIt, redirect & successmessage - My Forums]]> https://forums.modx.com/thread/?thread=102486 <![CDATA[Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552194 i use formIt for my contactpage.
everything is working, i get email after sending form but the successmessage is not there if use "redirect" in hooks. when i don't use redirecting the successmessage is showing. the strange thing is: errormessage is working in both cases.

what could that be?

this works (successmessage is showing):


        [[!FormIt?
            &hooks=`spam,email`
            &emailTpl=`kontaktMail`
            &successMessage=`<span class="successMessage">Vielen Dank für Ihre Nachricht.</span>`
            &validationErrorMessage=`<span class="errorBlue_big">Bitte überprüfen Sie ihre Eingaben.</span>`
            &emailTo=`mailadress`
            &clearFieldsOnSuccess=`1`
            &validate=`nospam:blank,
            name:required,
            email:email:required,
            text:required:stripTags`
        ]]
        
        [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p><br>`]] 
        [[!+fi.successMessage]]


this is not working (successmessage is not showing):

        [[!FormIt?
            &hooks=`spam,email,redirect`
            &redirectTo=`http://www.abc.ch#contact`
            &emailTpl=`kontaktMail`
            &successMessage=`<span class="successMessage">Vielen Dank für Ihre Nachricht.</span>`
            &validationErrorMessage=`<span class="errorBlue_big">Bitte überprüfen Sie ihre Eingaben.</span>`
            &emailTo=`email`
            &clearFieldsOnSuccess=`1`
            &validate=`nospam:blank,
            name:required,
            email:email:required,
            text:required:stripTags`
        ]]
        
        [[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p><br>`]] 
        [[!+fi.successMessage]]
]]>
thaasheef Jun 30, 2017, 02:37 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552194
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552231 Quote from: Bruno17 at Jul 02, 2017, 05:31 PM
if you have fastFields or pdoTools installed, you can use fastField - tags to get the url-query-params, like so (untested!):

[[!FormIt?
    &hooks=`spam,email,redirect`
    &redirectTo=`[[~[[*id]]]]#contact`
    &emailTpl=`kontaktMail`
    &validationErrorMessage=`<span class="errorBlue_big">Bitte überprüfen Sie ihre Eingaben.</span>`
    &emailTo=`email`
    &clearFieldsOnSuccess=`1`
    &validate=`nospam:blank,
    name:required,
    email:email:required,
    text:required:stripTags`
    &redirectParams=`{"success":"1"}`
]]

[[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p>
`]] 

[[!#get.success:is=`1`:then=`
<span class="successMessage">Vielen Dank für Ihre Nachricht.</span>
`:else=``]]


thanks, but there arent any redirectParams in the url..]]>
thaasheef Jul 02, 2017, 05:44 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552231
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552230
[[!FormIt?
    &hooks=`spam,email,redirect`
    &redirectTo=`[[~[[*id]]]]#contact`
    &emailTpl=`kontaktMail`
    &validationErrorMessage=`<span class="errorBlue_big">Bitte überprüfen Sie ihre Eingaben.</span>`
    &emailTo=`email`
    &clearFieldsOnSuccess=`1`
    &validate=`nospam:blank,
    name:required,
    email:email:required,
    text:required:stripTags`
    &redirectParams=`{"success":"1"}`
]]

[[!+fi.validation_error_message:notempty=`<p>[[!+fi.validation_error_message]]</p><br>`]] 

[[!#get.success:is=`1`:then=`
<span class="successMessage">Vielen Dank für Ihre Nachricht.</span>
`:else=``]]

]]>
Bruno17 Jul 02, 2017, 05:31 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552230
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552228 Quote from: Bruno17 at Jun 30, 2017, 06:26 PM
you could set special redirectParams. If set, show the successmessage

can u give me an example, how to do this?]]>
thaasheef Jul 02, 2017, 04:19 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552228
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552202 Bruno17 Jun 30, 2017, 06:26 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552202 <![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552201
"action="[[~[[*id]]]]#myid"


Alternatively, you could submit the form with AJAX and on success have a thank you pop up show?]]>
lkfranklin Jun 30, 2017, 04:26 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552201
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552200 Quote from: lkfranklin at Jun 30, 2017, 04:08 PM
The form should clear once you've hit submit so pressing ctrl + r won't do anything and if there is a risk of submitting data again your browser will usually prompt you about resubmitting.

However, it sounds like you just need to put your thank you message into the content of your redirected resource if that's the approach you wanted to take.

thanks for your answer.. but if im pressing ctrl + r there is a prompt about resubmitting.
the problem is: i got a parrallax scrolling webpage, so the redirect webpage is the same.. but i need to set the redirect because of the anchor: #contact.
it seems like the success_message is empty.. after the submit..

any solutions? any tips?]]>
thaasheef Jun 30, 2017, 04:13 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552200
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552199
However, it sounds like you just need to put your thank you message into the content of your redirected resource if that's the approach you wanted to take.]]>
lkfranklin Jun 30, 2017, 04:08 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552199
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552198 Quote from: lkfranklin at Jun 30, 2017, 03:56 PM
I think it's because the redirect is made to redirect the user and show a success message or thank you page that you've prebuilt.

The successmessage method is usually used if you don't want to redirect the user but render out a thank you message on the same page as the form.

thanks mate. but if u dont redirect and u press "ctrl + r" you will resend all datas so u will send a new mail.. and if there is a redirect this isnt possible anymore. u know what i mean?]]>
thaasheef Jun 30, 2017, 03:58 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552198
<![CDATA[Re: Modx FormIt, redirect & successmessage]]> https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552197
The successmessage method is usually used if you don't want to redirect the user but render out a thank you message on the same page as the form.]]>
lkfranklin Jun 30, 2017, 03:56 PM https://forums.modx.com/thread/102486/modx-formit-redirect-successmessage#dis-post-552197