Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » 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: 1258 Views
  • Blackdog
    Avatar
    Community Member
    156 Posts

    Forms Link to this post

    I can see what you had in mind with the FormHolder function but I don't think injecting predetermined html into a form without the user specifying it is a good idea.

    Prior to SS I had done some sites with Code Igniter which was/is a great framework to use. I found the process of creating forms (which I normally loath) very easy and natural.

    Personally I think you should ditch the auto injecting of html and let the developer do a little bit more leg work to customise the form to how they want it. There is also extra html in there that doesn't really need to be there if the developers CSS skills are up to scratch.

    By removing the "field" & "$Type" call we could rely on the $extraClass or shorten to $Class which should be more than enough. Also remove $titleBlock and let the user specify this with a new LabelField directly above the field insert or where they need it separating it from the field. Totally scrap the wrapping span as it would not be needed and once again separating $rightTitleBlock & $messageBlock.

    Anyway...nothing major. Just a thought.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Forms Link to this post

    If you want to change the way a form renders by default, just take Form.ss from sapphire, put it into your own "Includes" directory for your templates, then change it.

    Then, you've got freedom to do things like:

    <form $FormAttributes>
       <% control Fields %>
          <div class="fieldHolder" id="$Name">
             <label for="$ID">$Title</label>
             $Field
          </div>
       <% end_control %>

       <div id="actions">
          <% control Actions %>
             $Field
          <% end_control %>
       </div>
    </form>

    There's also more functions to use in Form, I think you can also select each individual field as well - that way, you don't have to use LabelField and LiteralField in your code, which shouldn't be in there anyway!

    Sean

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Forms Link to this post

    Thanks for the pointers Sean.

    That sounds like a better solution.

    1258 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.