We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53567
    • 6 Posts
    hi guys, i got a problem.
    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]]
      • 17301
      • 932 Posts
      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.
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 53567
        • 6 Posts
        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?
          • 17301
          • 932 Posts
          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.
            ■ email: [email protected] | ■ website: https://alienbuild.uk

            The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
            • 53567
            • 6 Posts
            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?
              • 17301
              • 932 Posts
              You could put the id tag in the action to anchor the page down after submit

              "action="[[~[[*id]]]]#myid"


              Alternatively, you could submit the form with AJAX and on success have a thank you pop up show?
                ■ email: [email protected] | ■ website: https://alienbuild.uk

                The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                • 4172
                • 5,888 Posts
                you could set special redirectParams. If set, show the successmessage
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 53567
                  • 6 Posts
                  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?
                    • 4172
                    • 5,888 Posts
                    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><br>`]] 
                    
                    [[!#get.success:is=`1`:then=`
                    <span class="successMessage">Vielen Dank für Ihre Nachricht.</span>
                    `:else=``]]
                    
                    
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 53567
                      • 6 Posts
                      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..