Custom FormBuilder template [solved]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
douglas1438
Forum Members
Forum Members
Posts: 80
Joined: Thu Jul 21, 2011 10:29 am

Custom FormBuilder template [solved]

Post by douglas1438 »

With help from this forum I've successfully been using custom templates in FormBuilder so they integrate with Bootstrap.

http://forum.cmsmadesimple.org/viewtopi ... =7&t=71995

Up until now they've been simple forms with text inputs, I now need to add a date of birth field, with dropdowns for day, month and year. Along with a set of check boxes.

Can anyone tell me how I adapt the code below to reference these?

Current code for text input.

Code: Select all

<div class="form-group">
<label for="{$actionid}{$name->input_id}">Name</label>
<input class="form-control" type="text" name="{$actionid}{$name->input_id}" id="{$actionid}{$name->input_id}" title="Please enter your name" required="required"/>
</div>

Thank you.
Last edited by douglas1438 on Thu Dec 10, 2015 10:40 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Custom FormBuilder template

Post by Dr.CSS »

You're going to have to explain this in a little more detail than that...
douglas1438
Forum Members
Forum Members
Posts: 80
Joined: Thu Jul 21, 2011 10:29 am

Re: Custom FormBuilder template

Post by douglas1438 »

Please see my more recent post

http://forum.cmsmadesimple.org/viewtopi ... =7&t=73428

Unfortunately can't delete this one.

Thank you,
Chris
douglas1438
Forum Members
Forum Members
Posts: 80
Joined: Thu Jul 21, 2011 10:29 am

Re: Custom FormBuilder template

Post by douglas1438 »

Despite upsetting Jeff (for which I apologise) and spending countless hours playing with loops I'm still struggling to resolve this.

For someone with better Smarty knowledge than me I'm sure the solution must be very simple. I'm building a form template in formBuilder by calling each field individually.

Calling text fields works without problem:

Code: Select all

<input class="form-control" type="text" name="{$actionid}{$name->input_id}" id="{$actionid}{$name->input_id}" title="Enter your name" required="required" />
Also works for a date of birth set of dropdowns.

Code: Select all

<label for="{$actionid}{$dob_day->input_id}">Day</label>{$dob_day->input}
<label for="{$actionid}{$dob_month->input_id}">Month</label>{$dob_month->input}
<label for="{$actionid}{$year->input_id}">Year</label>{$year->input}
My problem is radio buttons, I know they are in an array but I can't come up with a foreach statement to pull them out, if I use {$test_radio|@print_r} I get the following:

Image

As you can see from the screen capture it is showing the radio button, i just can't work out how to reference it.

Could someone please tell me how I can display the group of radio buttons, with their values and labels in my template please?

Thank you,
Chris
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Custom FormBuilder template

Post by velden »

Something like (untested):

Code: Select all

{foreach from=$test_radio->input item=radiobutton}
  name: {$radiobutton->name}<br>
  title: {$radiobutton->title}<br>
  input (code): {$radiobutton->input|cms_escape}<br>
  input: input: {$radiobutton->input}<br>
{/foreach}
douglas1438
Forum Members
Forum Members
Posts: 80
Joined: Thu Jul 21, 2011 10:29 am

Re: Custom FormBuilder template [solved]

Post by douglas1438 »

Thank you so much velden that works perfectly.

Chris
Post Reply

Return to “Modules/Add-Ons”