To do this, you will probably need to create a custom RequiredFields
subclass to conditionally set which fields are required:
class CustomValidator extends RequiredFields {
public function php($data) {
if($this->form->buttonClicked()->actionName() == 'saveQuote') {
$this->addRequiredField('FieldName'); // ...
} else {
$this->addRequiredField('OtherFieldName'); // ...
}
return parent::php($data);
}
}
You then use this in your form like:
$form = new Form(
$this, 'FormName', $fields, $actions, new CustomValidator()
);