We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7885
    • 40 Posts
    the situation:
    if i have a form way too down in a webpage and send the form, either if the form is correctly sent or when a validation error ocurrs, when the webpage reloads and shows the div that contains the errors or shows the thank you message, this doesn’t show if the message is too down.

    what i’m looking for:
    can eForm reload the webpage using an anchor "#errors" for example?
    if the form is way too down, when the webpage reloads it will go to the anchor #errors (or other name) to show the errors. or #thanks to the thank you message

    can we do this in some way? its really important for me to fix my form to use this kind of behavior
    thanks for all smiley
      visit us at www.dospuntocero.cl
      • 30223
      • 1,010 Posts
      Simple,... just place the [+validationmessage+] placeholder directly in your document somewhere near the top (and remove it from the form template)
        • 7885
        • 40 Posts
        ok, this actually can be a solution, but there is a way to don’t use this kind of solution and use one more like the one I suggest?, look at my website so you’ll have a better understanding of my problem, i can’t put up the errors placeholder

        http://heliskiguides.com/make-a-reservation/sign-up.html

        by the way, thanks for the quick answer TobyL! laugh
          visit us at www.dospuntocero.cl
          • 30223
          • 1,010 Posts
          You could add the introduction text above the form using the eFormOnBeforeParse event and only display it when the form is displayed the first time (ie with a GET request). To do that you’d place a "form_intro" placeholder in your form template and populate this in the event function with the actual introduction text. (set $fields[’form_into’]=’the introduction text’) This way the validation text can be at the top of the page. (There’s no reason I imagine to have the same introduction text once the form is posted)

          See the eform documentation on using event functions.

          Of course it will also help to reduce the size of the masthead image....
            • 7885
            • 40 Posts
            thanks for your help TobiL, but i guess my english is not helping here...
            what i really need is that the scroll of the webpage goes down when you have an error or to see the thanks message, i guess modifying the makeUrl call for eForm... but instead of passing variables to the eForm redirection passing an anchor ... something like this

            $url = $modx->makeUrl(21,’’,’#errors’);

            is this possible? my idea is have this url at the ending of the proccess:

            http://heliskiguides.com/make-a-reservation/sign-up.html#thanks
            or
            http://heliskiguides.com/make-a-reservation/sign-up.html#error

            my final goal will be make something like http://dnevnikeklektika.com/uni-form/#error2
              visit us at www.dospuntocero.cl
              • 7231
              • 4,205 Posts
              Just add the anchor to the URL in the form template:

              <form id="contactForm" method="post" action="[~[*id*]~]#contactForm">


              How did you get the highlighting of the fields with error? I think that there is a tutorial/example for this someplace but figured I would ask anyway smiley
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don&#39;t know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 7885
                • 40 Posts
                thanks for the obvious workarround tongue

                regarding your question, eForm handles 2 types of errors: required and invalid and have variables for this classes when you instantiate eForm, the parameters are called:

                &requiredClass=`requeried`

                &invalidClass=`error`

                and inside my lame class names
                thanks pal laugh

                ahh and use uni-form!! its a really easy and stylish form to do good markup for eForm, you just add

                &cssStyle=’uni-form.css’

                and you have a nice way to create forms
                  visit us at www.dospuntocero.cl
                  • 26027
                  • 145 Posts
                  dospunctocero, I'm 4 years late asking this. Hope you're still there.

                  Did you ever get a solution to repositioning the page on a "Thank You" response. The technique supplied worked great for an error but I'd also like to use an anchor for Thank You.

                  Appreciate any help ... Sam
                  • I think you would need to create a custom redirection function and use the "&eFormOnMailSent" event to trigger it.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org