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.

Form Questions /

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

Incorporating Twitter Bootstrap Form Styles

Go to End

3 Posts   2089 Views


Community Member, 22 Posts

4 April 2012 at 3:01pm

Hey All,

I'm currently playing around with the Twitter Bootstrap front-end kit for a new site I'm working on. The way forms are styled is particularly attractive and lightweight (see, but I'm a little stuck in terms of making it play nice with SilverStripe.

Simply including the relevant CSS works as a starting point (basic text fields get formatted properly, for example), but certain elements require a little extra markup. Buttons, for example, need "btn" in the class attribute for the various button states to work.

Can anyone point me in the right direction? Which files do I need to work with in order to customise the markup used in form generation?


Forum Moderator, 5522 Posts

5 April 2012 at 10:55pm

The individual form field templates are hard coded in PHP and hard to replace easily in 2.*. In 3.0 they are available as templates so you can edit to your hearts content.

If you're wanting to customize your own form classes you can use templates -


Community Member, 22 Posts

23 April 2012 at 11:16am

Thanks very much, I'm still on 2.4.7 with this particular site so I just hacked some of the core files. Not ideal, obviously, but given that my next upgrade will be to 3.x, not a big deal. Thanks again for the reply.