Page 1 of 1

Controlling checkbox labels in Formbuilder

Posted: Sat Jan 24, 2015 11:20 pm
by jraderma
I've been banging my head for hours trying to get label text side-by-side with form checkboxes using Formbuilder 0.8.1.1. In the default FB template, labels for non-multi-part form fields can be tweaked with no problem, but labels for checkboxes seem to be pre-defined with the piece

Code: Select all

{$entry->input[numloop]->name}
In order to get the label text directly next to the checkbox, I need to have the opening <label> tag before the <input> tag, and the closing </label> tag after the <input> tag.

The template outputs this:

Code: Select all

<input type="checkbox" class="cms_checkbox" name="cntnt01fbrp__74[]" value="1"  id="fbrp__74_1_0" /><label for="fbrp__74_1_0">Sample text</label>
And I need this:

Code: Select all

<label for="fbrp__74_1_0"><input type="checkbox" class="cms_checkbox" name="cntnt01fbrp__74[]" value="1"  id="fbrp__74_1_0" />Sample text</label>
Any help would alleviate the headache that has set in! For the record, here is my setup with no mods.
CMS Version 1.11.11

CMSMailer 5.2.2
FileManager 1.4.5
MenuManager 1.8.6
ModuleMgr. 1.5.8
News 2.14.4
Printing 1.1.2
Search 1.7.11
ThemeManager 1.1.8
TinyMCE 2.9.12
CGExtensions 1.31
jQuery 1.2.0
FormBuilder 0.8.1.1
Captcha 0.5.0
CGCalendar 1.10.0.1
youtubeplayer 1.3
CMSPrinting 1.0.5
MicroTiny 1.2.7


Current PHP Version (phpversion) 5.3.29
Server API (server_api) cgi-fcgi
Server Database (server_db_type) mysql (mysql)
Server Database Version (server_db_version) 5.1.39
Server Software (server_software) apache
Server Operating System (server_os) linux 3.1.9-vs2.3.2.5vs2.3.2.5+ on x86_64

My thanks-
JonR

Re: Controlling checkbox labels in Formbuilder

Posted: Sun Jan 25, 2015 10:47 am
by Rolf
Try this example Template and Stylesheet
https://www.cmscanbesimple.org/blog/ass ... e-per-page

Re: Controlling checkbox labels in Formbuilder

Posted: Sun Jan 25, 2015 7:22 pm
by jraderma
Rolf,

You have my sincere gratitude. I did not implement all the CSS from your template, but just looking at some of the rules formed a solution quite quickly. Using your rule as a springboard, this is all I had to do to make this happen:

Code: Select all

form input[type="checkbox"] + label,
form input[type="radio"] + label  {
  display: inline;
}
I can't tell you how relieved I am! :D

I wonder in future iterations of FormBuilder if the user could better control labeling? It's standard in HTML5 now to straddle the checkbox or radio inputs with the <label> tag to achieve this effect without the need to use CSS.

My thanks...
Jon

Re: Controlling checkbox labels in Formbuilder

Posted: Mon Jan 26, 2015 9:09 am
by Rolf
We - the new team of FB developers - already planned to make the next big release of FormBuilder much more user friendly.
My template and stylesheet will be added as default in the module, making it easier to adapt.

Re: Controlling checkbox labels in Formbuilder

Posted: Tue Jan 27, 2015 6:35 pm
by jraderma
Rolf,

That sounds great. On behalf of all the FB users out there, thank you to the entire FB team for all of your efforts!

Jon

Re: Controlling checkbox labels in Formbuilder

Posted: Wed Jan 28, 2015 10:25 am
by paulbaker
jraderma wrote:That sounds great. On behalf of all the FB users out there, thank you to the entire FB team for all of your efforts!
+1 from me! O0 ;D