1778 Posts in 581 Topics by 555 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2614 Views |
-
Custom form template

11 August 2009 at 5:32am
Hi All,
I have created a new form class, as per: http://doc.silverstripe.com/doku.php?id=form#using_a_custom_template
I may be being a bit simple, but how do I then return that form in my page controller?
Cheers,
Mo
-
Re: Custom form template

11 August 2009 at 9:13pm Last edited: 11 August 2009 9:14pm
Hmm, I was obviously being a bit dense - All you have to do is add:
public function FormClass() {
return new FormClass($this,'FormClass');
}To your page controller and then:
$FormClass
To your page template file
Hope this helps someone,
Mo
-
Re: Custom form template

11 August 2009 at 10:09pm
Moving on from this actually, if you have a custom form template you can use $dataFieldByName(FieldName) to generate the correct form field in your template.
Is there any way of doing this with a form label? I have looked through the Form class and cant see anything obvious. Anyone done anything similar?
Mo
-
Re: Custom form template

11 January 2010 at 11:51pm
@ biapar yes you create the template FormClass and save it in includes.
-
Re: Custom form template

16 October 2010 at 9:48pm
I think that SS team would to write this into Custom template help page...
public function FormClass() {
return new FormClass($this,'FormClass');
}To your page controller and then:
$FormClass
To your page template file
| 2614 Views | ||
|
Page:
1
|
Go to Top |


