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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

adding style classes to a customform


Go to End


2 Posts   1393 Views

Avatar
TerryMiddleton

Community Member, 108 Posts

19 May 2009 at 8:28am

How can you add a style class to a form or even a custom form?

I'm using jquery to validate a customform build but I need to add some style classes to the field.

How is this possible?

Terry

Avatar
Willr

Forum Moderator, 5523 Posts

19 May 2009 at 1:52pm

Edited: 19/05/2009 1:53pm

Adding classes to the form or the form fields? If you want to add classes to a field you can do $field->addExtraClass('Something'); as long as $field is a valid FormField object

See http://api.silverstripe.com/forms/core/FormField.html#addExtraClass for more information