On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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]]
    • 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: lk@alienbuild.uk | ■ 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.
      • 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?
        • 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: lk@alienbuild.uk | ■ 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.
          • 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?
            • 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: lk@alienbuild.uk | ■ 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.
              • 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!
                • 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?
                  • 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!
                    • 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..