Form Builder CSS class

edited October 2012 in Share
I see there is a "class" option for the form builder however it does not seem to be working. I have it formatted as:

$fields['website_design'] = array('type' => 'checkbox', 'options' => array('yes' => 'yes', 'no' => 'no'), 'class' => 'formtest');

Neither the label nor the checkbox (or the surrounding div) have the formtest css class set even though the above has been set.

Comments

  • edited October 2012
    I also tried the 'before_html' => 'div class="formtest"' (i did use < and > in the actual code, these forums don't let you display html), however it is automatically placing a closing tag as well so this doesn't really help me. I would need it to not automatically generate the closing div tag so I can place it further down in an after_html option.
  • edited 1:10PM
    Try using the type of "enum" instead of "checkbox" which will give you radio buttons. Is this using 0.93 or the 1.0 beta branch?
    https://github.com/daylightstudio/FUEL-CMS/tree/1.0
  • edited October 2012
    Sorry for including the yes/no array in the code above but I really am trying to do a checkbox. Even when formatted as $fields['website_design'] = array('type' => 'checkbox', 'class' => 'formtest'); it still doesn't work. It does however let me aply the class option to fields with no type defined (regular text fields). This is with 0.93.
  • edited 1:10PM
    That's a bug in 0.93 and should be fixed in 1.0 branch. To fix it, try adding the following to the Form_builder class on line 1334:
    'class' => $params['class']
  • edited 1:10PM
    That fixed it, thanks. Now, is it possible with the before_html and after_html options to not have it automatically create a closing div tag when an opening div tag is used?
  • edited 1:10PM
    Are you sure it is rendering the closing div tag or is that the Inspector in the browser displaying it perhaps because it was an unclosed tag?
  • edited 1:10PM
    I inspected the source and it seems like indeed that is what it is doing. It's displaying it differently in the inspector than in the actual source code. Thanks again. My final question since it ties in with this is is there a way to change the order in which the label and checkbox appear (I want the label on the right) on the fly or would the Form_builder class need modification. I don't want the label to always appear on the right, only for these particular checkboxes.
  • edited 1:10PM
    In 0.93 you can't really do it unless you add a " " (an empty space) for the label value and then do an after_html for the field with your label. In 1.0 you can pass a "display_label" boolean parameter to the field to hide it.
  • edited 1:10PM
    I'll check out 1.0. I really appreciate the continual support you provide for this CMS. Thanks.
  • edited 1:10PM
    No problem. Be sure to download and install the user guide module for 1.0 beta. The Form_builder class was overhauled a bit as well as a bunch of new features and bug fixes.
    https://github.com/daylightstudio/FUEL-CMS-User-Guide-Module

    Other modules (e.g. blog, backup, cronjobs, etc) are separated out but can be individually pulled down and installed:
    https://github.com/daylightstudio
Sign In or Register to comment.