Back & Next forms

  • Profile Image
    RHemery
    Asked on May 12, 2015 at 05:02 AM

    Hi there, I have a form here:

    http://www.bedford.ac.uk/misc/2015-welcome-day

    When you fill it in and click Next, is there anyway to prevent it scrolling down the page rather than it staying fixed at the top?

    Thanks

    Rich

  • Profile Image
    Boris
    Answered on May 12, 2015 at 06:06 AM

    Hello.

    This is caused by having multiple JotForm forms embedded into the page, and the bottom form (Sign-up to our e-newsletters) is thinking that upon submitting another form you are trying to scroll this one into view.

    Please edit the HTML code of your website, and try changing this code:

                        <script type="text/javascript">
                            window.handleIFrameMessage = function (e) {
                                var args = e.data.split(":");
                                var iframe = document.getElementById("JotFormIFrame");
                                if (!iframe) return;
                                switch (args[0]) {
                                    case "scrollIntoView": iframe.scrollIntoView(); break;
                                    //case "setHeight": iframe.style.height = args[1] + "px"; break;
                                }
                            };

                            if (window.addEventListener) {
                                window.addEventListener("message", handleIFrameMessage, false);
                            } else if (window.attachEvent) {
                                window.attachEvent("onmessage", handleIFrameMessage);
                            }
                        </script>

    into this:

                        <script type="text/javascript">
                            window.handleIFrameMessage = function (e) {
                                var args = e.data.split(":");
                                var iframe = document.getElementById("JotFormIFrame");
                                if (!iframe) return;
                                switch (args[0]) {
                                    //case "scrollIntoView": iframe.scrollIntoView();
                                    break;
                                    //case "setHeight": iframe.style.height = args[1] + "px"; break;
                                }
                            };

                            if (window.addEventListener) {
                                window.addEventListener("message", handleIFrameMessage, false);
                            } else if (window.attachEvent) {
                                window.attachEvent("onmessage", handleIFrameMessage);
                            }
                        </script>Please try it out and let us know how it goes.

  • Profile Image
    RHemery
    Answered on May 12, 2015 at 08:09 AM

    Thanks, perfect.

  • Profile Image
    Boris
    Answered on May 12, 2015 at 08:16 AM

    You are welcome, I'm glad that it helped.

    Please don't hesitate to contact us again if you need any help with using JotForm, we are here to help.

    Kind regards.