I have a form that has several actions, for example. Create an order and create an offer.
Depending on what action is clicked, I need to apply another check. For example, an order code is not required for a quote.
Is this possible in Silverstripe? If not, how would I get this?
public function Order($request=null) {
$form = Form::create(
$this,
__FUNCTION__,
FieldList::create(
TextField::create('Name', 'Your Full Name'),
TextField::create('OrderRef', 'Purchase Order #')
),
FieldList::create(
LiteralField::create('Cancel', '<a class="cancel button alert">Don\'t save</a>'),
FormAction::create('saveQuote', 'Save Quote'),
FormAction::create('saveOrder', 'Save Order')->addExtraClass('success')
),
RequiredFields::create('Name', 'OrderRef')
);
return $form;
}
source
share