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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

Incorporating Twitter Bootstrap Form Styles


Go to End


3 Posts   2109 Views

Avatar
kylehudson00

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 http://twitter.github.com/bootstrap/base-css.html#forms), 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?

Avatar
Willr

Forum Moderator, 5523 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 - http://doc.silverstripe.org/sapphire/en/topics/forms#using-a-custom-template

Avatar
kylehudson00

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.