I have a cusrtom form, with multiple subclasses forms that I want to augment the Validation porion on the sublcasses, but I'm not sure how to go about it.
The Custom Form
class LeadCaptureForm extends Form {
public function __construct($controller, $name) {
$fields = new FieldList(
$holder
);
$actions = new FieldList(
FormAction::create("leadSubmit")->setTitle($controller->FormButton)->setUseButtonTag(true)->addExtraClass('button red small point-right')
);
$validation = new RequiredFields(array('Email'));
parent::__construct($controller, $name, $fields, $actions, $validation);
}
The sublcassed forms look like this
class MarketForm extends LeadCaptureForm {
function __construct($controller, $name) {
parent::__construct($controller, $name);
$newfields = new CompositeField(
$house,
$homedeet,
$propDeets
);
$this->Fields()->insertBefore($newfields, "main");
}
}
On the MarketForm I'd like to add a few of the LeadCaptureForms to the validation as well as the the fields from MarketForm.