Page 1 of 1
Formbuilder submission anchor
Posted: Tue Jul 19, 2016 6:27 am
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.
Re: Formbuilder submission anchor
Posted: Sun Jul 24, 2016 12:41 pm
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
Re: Formbuilder submission anchor
Posted: Thu Jul 28, 2016 9:23 am
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?
Re: Formbuilder submission anchor
Posted: Thu Jul 28, 2016 12:51 pm
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...