Jump to:

11002 Posts in 2734 Topics by 1823 members

All other Modules

SilverStripe Forums » All other Modules » User Defined Form - styling form fields

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 3036 Views
  • BigChris
    Community Member
    63 Posts

    User Defined Form - styling form fields Link to this post


    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 UserDefinedForm.ss 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.


  • Willr
    Forum Moderator
    5511 Posts

    Re: User Defined Form - styling form fields Link to this post

    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 - http://doc.silverstripe.org/doku.php?id=form&s=form#using_a_custom_template

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.