Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » css for forms

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1215 Views
  • lememily
    Avatar
    Community Member
    1 Post

    css for forms Link to this post

    Hi does anyone know if its possible to customize the form elements? like instead of default sumbit buttons if you can use ur own graphic. also where is the file that controls those buttons?
    thanks

  • Hamish
    Avatar
    Community Member
    712 Posts

    Re: css for forms Link to this post

    Hi hi,

    You can add classes to any Form field with the method "addExtraClass".

    So, for example, you might have:

    $nameField = new TextField("Name", "Name");
    $nameField->addExtraClass('customNameFieldClass');

    Now you can jump into any of your css files (or use Requirements::themedCSS($stylesheet) to add a new stylesheet) and apply whatever styling you like.

    You can also style by ID - have a look at the generated source for the form you want to style and you'll see there is a pattern. For example, the standard login form 'name' field is called "MemberLoginForm_LoginForm_Email", so you could style by the ID if you prefer.

    1215 Views
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.