Controlling checkbox labels in Formbuilder

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
jraderma
Forum Members
Forum Members
Posts: 18
Joined: Sat Jan 24, 2015 10:53 pm

Controlling checkbox labels in Formbuilder

Post 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
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Controlling checkbox labels in Formbuilder

Post by Rolf »

Try this example Template and Stylesheet
https://www.cmscanbesimple.org/blog/ass ... e-per-page
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
jraderma
Forum Members
Forum Members
Posts: 18
Joined: Sat Jan 24, 2015 10:53 pm

Re: Controlling checkbox labels in Formbuilder

Post 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
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Controlling checkbox labels in Formbuilder

Post 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.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
jraderma
Forum Members
Forum Members
Posts: 18
Joined: Sat Jan 24, 2015 10:53 pm

Re: Controlling checkbox labels in Formbuilder

Post 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
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Controlling checkbox labels in Formbuilder

Post 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
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Post Reply

Return to “The Lounge”