1

I have a form built with RSForm pro on my website home page and when user submit that, it redirects them to a second form (booking form) and auto populate the fields selected on first form. Im wondering how I could scroll up the screen if user accessed the second form trough home page form.

I found this JS in RsForm documentations but it's for multipage form.

<script>
function rsfp_showPage(thePage) {
  RSFormProUtils.removeClass(thePage, 'formHidden');
  window.scrollTo(0, findPos(document.getElementById('userForm')));
}
function findPos(obj) {
  var curtop = 0;
   if (obj.offsetParent) {
    do {
        curtop += obj.offsetTop;
       } while (obj = obj.offsetParent);
   return [curtop];
   }
}

thanks in advance

  • you say that when someone reaches to that second form from your homepage, he will be scrolled down - and you want to scroll him back to top? Why he would be scrolled down at first place anyway? – FFrewin Mar 8 '17 at 22:14
  • Sorry, I did a mistake in the question. I need to scroll down and focus on the form. – NLA Mar 9 '17 at 9:11
1

I think you can do this in a much simpler way. In the HTML Layout of the second form, set "Auto Generate Layout" to "No". Then, add the following to the very beginning of the HTML:

<a name="#form-2"></a>

In your first form, just ensure that it redirects to the following URL: link-to-your-second-form#form-2

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.