CMS MADE SIMPLE FORGE

Form Builder

 

[#12416] CSS class for Radio Button Group not being applied to input tag

avatar
Created By: Christine Collen (ccollen)
Date Submitted: Tue Feb 16 12:43:26 -0500 2021

Assigned To:
Version: 1.1
CMSMS Version: 2.2.13
Severity: Minor
Resolution: Awaiting Response
State: Open
Summary:
CSS class for Radio Button Group not being applied to input tag
Detailed Description:
I noticed that the CSS class field on the advanced setting tab for radio button
group type field was being ignored in the rendered form code.
I took a look at the class file RadioGroupField.class.php and saw the problem at
line 107 in the GetFieldInput function - it did not include the class property.

I have hacked the code so that the class property is included.

Before hack:
$thisBox->input = '<input type="radio" name="'.$id.'fbrp__'.$this->Id.'"
value="'.($i+1).'"';

My hack:
$thisBox->input = '<input type="radio" class="'.$css_class.'"
name="'.$id.'fbrp__'.$this->Id.'" value="'.($i+1).'"';

where $css_class is set as follows at top of this function:
$css_class = $this->GetOption('css_class');

Please note that there is a similar bug in the CheckBoxField.class.php but I
shall raise another bug report for this as it is a more complicated hack.




History

Comments
avatar
Date: 2021-02-17 08:03
Posted By: Rolf (rolf1)

Thanks for your report and fix suggestion, we have looked into it.

The current situation works though but in a different way… The provided class is
added to a wrapper div and *not* to the input field itself. Changing this would
probably break the styling at other sites.
It is as design as per the original developer intentions, and we are refactoring
the field PHP classes for future versions to not only make FormBuilder more
versatile, but also keep backwards compatibility as much as possible.
So we won't fix it at the moment as there are ways to work around that in the
template and stylesheet without having to hack the PHP code, in example:

.provided_class input[type="checkbox”] { ... }

See also https://cmscanbesimple.org/blog/styling-forms
      
Updates

Updated: 2021-02-17 08:03
resolution_id: => 10