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:

All other Modules /

Discuss all other Modules here.

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

User Defined Form - styling form fields

Go to End

2 Posts   4061 Views


Community Member, 63 Posts

11 January 2010 at 9:05am


I have a contact us page and using it with the User Defined Form module to create a contact form. Its setup as another template page called and all is working fine.

But, I would like to customise the styling of the Form by adding css classes to it. To use the form on the template I add the silverstripe variable $Form.

Is it possible to create another template for $Form so that I can over ride the default layout and add additional classes?
If so what would I call the template file and where would it go (Inside the include?)

I looked over the Module and the base Silverstripe code but could not figure out away to style the Form.

Any help is greatly appreciated.



Forum Moderator, 5523 Posts

11 January 2010 at 1:22pm

You're going to have some issues trying to customize the html output of the UDF. If you want to edit the style of the form the best way is to use CSS to get the positioning / style effects. The form fields are fairly well equipped with class's which you can use as styling hooks so even with the existing html you should have enough options to get most form layouts working.

You can customize the form output but it means you're hard coding the form fields so makes using a template on a UDF kinda pointless -