mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Update simple-contact-form.md
corrects the description about the order of the arguments passed while creating Form object.
This commit is contained in:
parent
3e4bf08f36
commit
b5a7be6082
@ -46,7 +46,8 @@ We then create a `[api:FieldList]` of the form actions, or the buttons that subm
|
|||||||
:::php
|
:::php
|
||||||
return new Form($this, 'Form', $fields, $actions);
|
return new Form($this, 'Form', $fields, $actions);
|
||||||
|
|
||||||
Finally we create the `Form` object and return it. The first argument is the name of the form – this has to be the same as the name of the function that creates the form, so we've used 'Form'. The second argument is the controller that the form is on – this is almost always $this. The third and fourth arguments are the fields and actions we created earlier.
|
Finally we create the `Form` object and return it. The first argument is the controller that the form is on – this is almost always $this. The second argument is the name of the form – this has to be the same as the name of the function that creates the form, so we've used 'Form'. The third and fourth arguments are the fields and actions we created earlier.
|
||||||
|
|
||||||
|
|
||||||
To show the form on the page, we need to render it in our template. We do this by appending $ to the name of the form – so for the form we just created we need to add $Form. Add $Form to the themes/currenttheme/Layout/Page.ss template, below $Content.
|
To show the form on the page, we need to render it in our template. We do this by appending $ to the name of the form – so for the form we just created we need to add $Form. Add $Form to the themes/currenttheme/Layout/Page.ss template, below $Content.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user