Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getEditForm($id) {
- // Create a validator
- $validator = new RequiredFields('Name', 'Price');
- $record = new Booking();
- // Create form actions & required fields
- switch($id) {
- case 'new':
- $actions = new FieldSet(
- new FormAction('doSaveLink', "Save Booking")
- );
- break;
- case 'buy':
- $actions = new FieldSet(
- new FormAction('doAddVoucher', "Add Voucher To Cart")
- );
- $validator = new RequiredFields('Title', 'FirstName', 'Surname', 'DOB', 'Email', 'PostCode', 'Address', 'Address2', 'City', 'Country', 'Tel1');
- break;
- case 'redeem':
- break;
- default:
- $record = DataObject::get_by_id('Booking', $id);
- $actions = new FieldSet(
- new FormAction('doUpdateLink', "Update Booking")
- );
- break;
- }
- $fields = $record->getCMSFields($id);
- $form = new Form($this, "EditForm", $fields, $actions, $validator);
Add Comment
Please, Sign In to add comment