Jump to:

3447 Posts in 1031 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » What is the purpose/function of $Form in the template?

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

Page: 1
Go to End
Author Topic: 809 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    What is the purpose/function of $Form in the template? Link to this post

    Hi,

    I'm trying to create a simplified template (based on the tutorial) and trying to remove unnecessary code.

    I notice that the code

    $Form

    exists in the Tutorial template.

    What does it do? From what I can tell so far, it provides the admin login form code. Does it do anything else? Is its functionality documented anywhere?

    Thanks very much.

    VWD.

  • swaiba
    Avatar
    Forum Moderator
    1796 Posts

    Re: What is the purpose/function of $Form in the template? Link to this post

    When you have a

    function Form()


    in your controller - it shows it, when you don't you'll never know it was there... for example enable comments on a page and the $Form will be used.

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: What is the purpose/function of $Form in the template? Link to this post

    OK - Thanks for that Swaiba.

    So it seems like something important, and that I have to keep in the template? (Although I'm not using comments in this instance)

    Also where does the admin login form code reside?

    Thanks Swaiba.

    VWD.

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: What is the purpose/function of $Form in the template? Link to this post

    So it seems like something important, and that I have to keep in the template? (Although I'm not using comments in this instance

    You need it at least on Page.ss (or Security.ss) as that is what LoginForm renders into. UserForms (if you use it) will also use $Form.

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