Append css class to form control

70 views
Skip to first unread message

Blastiko

unread,
Apr 6, 2022, 4:21:13 PM4/6/22
to CFWheels
Hi all,
I set this in config/settings.cfm

set(
functionName="checkBox",
class="form-check-input",
labelPlacement="after",
labelClass="form-label"
);

but if use this:
#checkBox(name="assetsfile[]", class="assetsfile", label="")#

the class "assetsfile" overwrite setting class "form-check-input" and i obtain:
<input class="assetsfile" id="assetsfile--1" name="assetsfile[]" type="checkbox" value="1">.

Is there a workaround to preserve settings in settings.cfm without overwrite?
Final result i want is:
<input class="form-check-input assetsfile" id="assetsfile--1" name="assetsfile[]" type="checkbox" value="1">

Thanks

Risto

unread,
Apr 7, 2022, 2:00:57 PM4/7/22
to CFWheels
The quickest way would be to add class form-check-input with assetfile.

#checkBox(name="assetsfile[]", class=" "form-check-input assetsfile", label="")#

I'm guessing your using checkBoxTag() as checkbox() requires objectname/property





Blastiko

unread,
Apr 8, 2022, 6:54:25 AM4/8/22
to CFWheels
Hi Risto and thank for your answer.
You're right: the func is checkBoxTag not chechBox, sorry.

Then, yeah, i know that i can put all class in class control directly in, but i want to avoid that, because i must remember what i set in config file and (most important) if i change something in config file i must consequently remember to change all interested controls.
Would be interesting to have a property like classadd="...." that it use settings in config file and add content of "classadd" property.

Peter Amiri

unread,
Apr 27, 2022, 12:56:32 PM4/27/22
to CFWheels
@Blastiko

Sorry I wasn't able to reply sooner, I've been out of the country for the last few weeks. I like your idea for a "classadd" attribute. Do you mind opening an issue with that request so we can capture the idea. You can open an issue at https://github.com/cfwheels/cfwheels/issues

-Peter

Blastiko

unread,
Apr 28, 2022, 9:25:32 AM4/28/22
to CFWheels
Hi Peter
Done, issue #1115
Thank you
Reply all
Reply to author
Forward
0 new messages