Checkboxes in multiple columns within form

ScorpiousDelectus 11 Sep, 2011
Hi folks, first time Joomla user and first time Chronoform user. I have a form with 11 checkboxes and due to the alignment of the checkboxes, they're over to the left and all in a vertical list (they look horrible running horizontally). Is there a way to have the checkboxes fill multiple columns (thinking two at this stage) to fill out the form space a bit more and prevents the form from being so long?
GreyHead 15 Sep, 2011
Hi ScorpiousDelectus,

There's no automatic way. You can copy the Form HTML for the checkbox group, paste it into a Custom element and then edit the HTML to give you whatever layout you prefer.

Bob
john29 11 Oct, 2011
Greyhead, im interested in doing this checkbox group in 3 columns too.. could you be a little more in depth about how to do this?
john29 11 Oct, 2011
ok, actually i figure this out,- MOSTLY... i got the form HTML and i cut and paste the parts i needed into a table and put it in a custom form, and it looks fantastic on the front end: http://mayfieldwebdesign.com/weaverbeta/index.php/request-access

but when you submit, the email submission looks like this:
Forums image 1

now, i realize what its doing, that the items i chose when i tested the form are showing up as text, and the ones i DIDNT choose are showing the code, but is there a way to make the ones that dont get chosen show up as "no" or "null" or something like that?
GreyHead 12 Oct, 2011
Hi John,

You are correct that the unchecked items are showing up with the form names. This is because Un-checked checkboxes don't return any values at all when the form is submitted so ChronoForms can't tell that the results are missing.

In ChronoForms v4 RC 2.0 Max introduced 'ghost' values which you can set to display values for un-checked checkboxes. They are on the Ghost tab of the element configuration.

That probably won't help you here though s you are using a Custom Code action :-(

There are a couple of possible solutions.

a) You can change the names of the checkbox inputs so that they all use the same array name e.g. name='catalog_request[]'. Then drag a Handle Arrays action into the OnSubmit event before the Email and put {catalog_request} in the email. Then you'll get a result like "Accents and Accessories, LCD Arm Mount, Stainless Steel Products, Trashcans"

b) You can run a PHP snippet in a Custom code action before the email to go through the list of names and put 'null' values to those which aren't checked.
<?php
$catalog_request = array (
  'accents_and_accessories',
  'buffet_displays',
  . . . 
  'trays_rack_cans_and boxes',
  'waiting_area_furniture'
);
foreach ( $catalog_request as $k ) {
  if ( !isset($form->data['catalog_request_list_'.$k]) ) {
    $form->data['catalog_request_list_'.$k] = '-';
  }
}
?>
This will insert a dash as the value of the unchecked items.

Bob
john29 12 Oct, 2011
thank you for the response... im very new to this, could you expand on option 1 a little more? im not a coder, but im good at following directions🙂
john29 12 Oct, 2011
i tried using your first suggestion and i feel like im close but im just not 100% sure of where to put the code, or how to enter the 'array name'...
john29 17 Oct, 2011
greyhead could you help me out with this?
This topic is locked and no more replies can be posted.