Formbuilder submission anchor

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
EdelweissD
New Member
New Member
Posts: 9
Joined: Sat Jun 04, 2016 9:59 pm

Formbuilder submission anchor

Post by EdelweissD »

Hi, set up formbuilder and working nicely with the submission message appearing where the form is usually. However, the form is down the page and I can't work out where to put the anchor link when the form is submitted?

Running Formbuilder: 0.8.1.4
CMSMS: 2.1.3

thanks.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1976
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder submission anchor

Post by Jo Morg »

Form templates are easy to customize. If you take a look at the form generated HTML, you will see what I mean. On the template I use something along the lines of:

Code: Select all

<form class="formclass" id="cntnt01moduleform_1" method="post" action="{cms_selflink page=$page_alias urlonly=1}/#anchor" class="cms_form" enctype="multipart/form-data">
This replaces the {$fb_form_start} on the template. Just make sure that the id is the one on the original rendered HTML, adjust the class to your needs and replace the #anchor by your anchor name. It should work fine.
HTH
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
EdelweissD
New Member
New Member
Posts: 9
Joined: Sat Jun 04, 2016 9:59 pm

Re: Formbuilder submission anchor

Post by EdelweissD »

Thanks Jo. I tried what you said and it went back to the anchor, but wouldn't actually submit the form. After a bit of playing around, I fudged it and copied the html output of {$fb_form_start} and <div>{$fb_hidden}</div> and then just pasted it back into the form template with the added anchor, and the selflink tag. It all works now.

If I have time, I'll try and learn a bit more about smarty tags. This is what I pasted in for reference:

<form id="m50d18moduleform_1" method="post" action="{cms_selflink page="page_alias" urlonly=1}/#anchor" class="cms_form" enctype="multipart/form-data">
<div class="hidden">
<input type="hidden" name="mact" value="FormBuilder,m50d18,default,1" />
<input type="hidden" name="m50d18returnid" value="1" />
<input type="hidden" name="page" value="1" />
<input type="hidden" name="m50d18fbrp_callcount" value="1" />
</div>

<div><input type="hidden" id="m50d18form_id" name="m50d18form_id" value="3" />
<input type="hidden" id="m50d18fbrp_continue" name="m50d18fbrp_continue" value="2" />
<input type="hidden" id="m50d18fbrp_done" name="m50d18fbrp_done" value="1" />
</div>

There is one thing though, I have this same form on secondary pages too, but when I submit the form from the second page for example, it goes to the home page. I tried adjusting the cms_selflink tag to no avail.

I haven't made the URLs pretty yet, could this be the problem?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1976
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder submission anchor

Post by Jo Morg »

EdelweissD wrote:Thanks Jo. I tried what you said and it went back to the anchor, but wouldn't actually submit the form.[/quote
Jo Morg wrote:Just make sure that the id is the one on the original rendered HTML
As you ended up figuring out the form id needed adjustment.
EdelweissD wrote:There is one thing though, I have this same form on secondary pages too, but when I submit the form from the second page for example, it goes to the home page. I tried adjusting the cms_selflink tag to no avail.

I haven't made the URLs pretty yet, could this be the problem?
Jo Morg wrote:

Code: Select all

<form class="formclass" id="cntnt01moduleform_1" method="post" action="{cms_selflink page=$page_alias urlonly=1}/#anchor" class="cms_form" enctype="multipart/form-data">
EdelweissD wrote:action="{cms_selflink page="page_alias" urlonly=1}/#anchor"
Look at my example: action="{cms_selflink page=$page_alias urlonly=1}/#anchor" not action="{cms_selflink page="page_alias" urlonly=1}/#anchor"
$page_alias should peek the current page alias and use it for the form submission. "page_alias" probably doesn't even exist as an alias on your setup...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “Modules/Add-Ons”