-
RHemeryAsked on May 12, 2015 at 5: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
-
BorisReplied on May 12, 2015 at 6: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. -
RHemeryReplied on May 12, 2015 at 8:09 AM
Thanks, perfect.
-
BorisReplied on May 12, 2015 at 8: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.