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 style classes to a customform


Reply

2 Posts   914 Views

Avatar
TerryMiddleton

19 May 2009 at 8:28am Community Member, 108 Posts

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

19 May 2009 at 1:52pm (Last edited: 19 May 2009 1:53pm), Forum Moderator, 5511 Posts

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