Page 1 of 1

Formbuilder - 'next page' to anchor on page

Posted: Wed Jan 08, 2014 2:33 pm
by Edwin_IandD
Hello everybody,

I hope this is possible:

I am building a multiple page form in formbuilder and it all works really well except for one thing.

On the website there is a big header with a menu and a couple of stunning photos that takes up the whole of the viewport. The main content (including the form) is underneath.

Now obviously I do not want to show the whole top half of the page when somebody goes to the next page of the form, but automatically go to the top of the next page of the form.

I can't seem to find any way of doing this in the form template (where I assume I should change this). If anybody has any ideas that would be great.

Many thanks, Edwin

Re: Formbuilder - 'next page' to anchor on page

Posted: Wed Jan 08, 2014 3:36 pm
by velden
Would a solution with ajax be an option for you (no need to reload the whole page)?

Regarding the anchor: do you use a custom form builder template or just one of the default (generic) ones?

BTW: don't know if it's possible at all to use #anchor in POST url's...

Re: Formbuilder - 'next page' to anchor on page

Posted: Wed Jan 08, 2014 4:47 pm
by JohnnyB
I don't have a multi-page form to look at and was wondering what the URL looks like on the second page? Is there a query string in it that can be looked up or 'pretty urls'? If there is a query string, you could test for it in your Layout Template and then do an if/then statement to hide the header image when that query is found.

For example, if Formbuilder generates a URL for the second page similar to:
;http://my-webpage-form.com/index.php?formbuilder_page=2
You can use {$smarty.get.page} inside of your layout template to test if the user is on page 2.

Using the Contains Modifier plugin will make it easy to do inside your template:

Code: Select all

{if !$smarty.get.page|contains:'formbuilder_page=2'}
...<img src="my-cool-header.png">...
{/if}
So, if the URL doesn't indicate the user is viewing page 2, then show the header image....


Another approach is to set a cookie when the user goes to page 2. That can be done by using the Call to a User Defined Tag field in formbuilder after your page break field. The UDT will set a cookie, then you can test inside of your template for the cookie. You should probably destroy the cookie after the form is submitted using another UDT.

In your template, you could test:

Code: Select all

{if isset($smarty.cookies.multipageform) && $smarty.cookies.multipageform == 'TRUE'}
...<img src="my-cool-header.png">...
{/if}
The UDT called might look something like this to set the cookie:

Code: Select all

$name = 'multipageform';
$value = 'TRUE';
$expire = 0;
$path = '/';
setcookie($name, $value, $expire, $path, '', 0, 0);
to unset it, change the $expire to something like, time() - 3600 in another UDT.


*** completely untested, sorry *** Let us know if you try this and it works. ;D

Re: Formbuilder - 'next page' to anchor on page

Posted: Wed Jan 22, 2014 8:57 am
by Edwin_IandD
Thanks a lot for the reactions.

I must admit that under the pressure of time and getting the job finished I went for the easy solution by hiding the header using CSS.

A 'back to top' button next to the form will unhide the header just in case somebody would like to use the menu on the top of the page.

Thanks anyway! Your solution might serve somebody else and I will surely keep it in mind for the next time.