I'm having trouble understanding the purpose of extending the Form object.
I thought creating a form Subclass would allow me to call it from any PageType, I'm trying to create a form that I can use on it Originally Intended page type as well as a Virtual Page
Below is the as it exists on my original PageType
function UserProductReviewForm() {
// Create fields
$fields = new FieldSet(
new TextField('Name','Name:'),
new EmailField('Email','E-Mail Address:'),
new TextField('Location','Location:'),
new OptionsetField('Rating','Rating',array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
)),
new TextField('Title','Review Title:'),
new TextareaField('Review'),
new HiddenField('ProductID', '', $this->ID),
new HiddenField('ProductName','',$this->Title)
);
// Create actions
$actions = new FieldSet(
new FormAction('doReview', 'Submit')
);
return new Form($this, 'UserProductReviewForm', $fields, $actions);
}
And the New Custom Form
class NewReviewForm extends Form {
/**Create Review Form****
************************
************************/
function __construct($controller, $name) {
// Create fields
//$recaptchaField = new RecaptchaField('MyCaptcha');
$fields = new FieldSet(
new TextField('Name','Name:'),
new EmailField('Email','E-Mail Address:'),
new TextField('Location','Location:'),
new OptionsetField('Rating','Rating',array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
),
new TextField('Title','Review Title:'),
new TextareaField('Review'),
new HiddenField('ProductID', '', $this->ID),
new HiddenField('ProductName','',$this->Title)
);
// Create actions
$actions = new FieldSet(
new FormAction('doReview', 'Submit')
);
parent::__construct($controller, $name, $fields, $actions);
}
How would I call this form in template?
And where do I define the new Action?
Thanks