Jump to:

2002 Posts in 1422 Topics by 616 members

Form Questions

SilverStripe Forums » Form Questions » Custom form - instantiation required in controller?

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

Page: 1
Go to End
Author Topic: 478 Views
  • KINKCreative
    Avatar
    Community Member
    56 Posts

    Custom form - instantiation required in controller? Link to this post

    Hi guys,

    I have a form that will have 1 action and a set radiobuttons or checkboxes that hold values of ID's of a set of pages. I was going to just generate the fields in the page template from within a <% control Children... %> block, then add the security field to the form and, of course, the action. I wold pass the form to the appropriate action in that page's controller and save the data accordingly.

    I am curious if there are any specific issues I would need to be aware off, I'm still pretty fresh in forms. Is it necessary to instantiate the form in the page's controller first and then pass it to the template and have a special form template, or would the above work?

    If there are any SS form tutorials that you like, please share...

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Custom form - instantiation required in controller? Link to this post

    The 3rd tutorial provides quite a good example of a custom form - http://doc.silverstripe.org/sapphire/en/tutorials/3-forms or the shorter topic docs - http://doc.silverstripe.org/sapphire/en/topics/forms.

    Yes you should always instantiate the form from the controller (controllers are required) not the model class and no, you don't need a custom form template if you don't need it.

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