Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Adding a class to radio field?


Reply


2 Posts   2121 Views

Avatar
Ryan M.

Community Member, 309 Posts

28 April 2010 at 12:39pm

I'd like to add a class to a set of radio fields, so they can be styled via javascript/css. How can this be done with the OptionsetField?

Avatar
Willr

Forum Moderator, 5513 Posts

28 April 2010 at 9:14pm

FormFields have a method addExtraClass() which you can use to add extra classes (think it does it to the container)

$radio = new OptionsetField(....
$radio->addExtraClass('classname');