daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Aug 14th, 2016 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function CustomOrderForm(){
  2.  
  3.          $fields = new FieldList (
  4.              FieldGroup::create(
  5.                 FileField::create('File', 'Upload File'),
  6.                 DropdownField::create('PrintSize', 'Print Size', array(
  7.                     'Small' => 'Small',
  8.                     'Medium' => 'Medium',
  9.                     'Large' => 'Large'
  10.                 )),
  11.                 DropdownField::create('PrintColor', 'Print Color', array(
  12.                     'Red' => 'Red',
  13.                     'White' => 'White',
  14.                     'Blue' => 'Blue'
  15.                 )),
  16.                 DropdownField::create('PrintMaterial', 'Print Material', array(
  17.                     'A' => 'A',
  18.                     'B' => 'B'
  19.                 ))
  20.             )->setTitle('Print Details')->addExtraClass('order-form__block pos-1'),
  21.             FieldGroup::create(
  22.                 TextField::create('FirstName'),
  23.                 TextField::create('LastName'),
  24.                 TextField::create('Telephone'),
  25.                 TextField::create('Email')
  26.             )->setTitle('Personal Information')->addExtraClass('order-form__block pos-2'),
  27.             FieldGroup::create(
  28.                 TextField::create('AddressLineOne','Address Line One'),
  29.                 TextField::create('AddressLineTwo','Address Line Two'),
  30.                 TextField::create('PostCode','Post Code'),
  31.                 TextareaField::create('Message', 'Additional print notes (if necesary)'),
  32.                 HiddenField::create('OrderID')->setValue( $this->generateRandomString())
  33.             )->setTitle('Delivery Information')->addExtraClass('order-form__block--last pos-3')
  34.         );
  35.  
  36.         $actions = FieldList::create(
  37.             FormAction::create('doCustomOrder', 'Complete Order')
  38.                 ->addExtraClass('order-submit')
  39.         );
  40.  
  41.         $validator = new RequiredFields('FirstName', 'Email');
  42.  
  43.         $forms = Form::create($this, 'CustomOrderForm', $fields, $actions, $validator)
  44.                     ->addExtraClass('order-form');
  45.  
  46.         return $forms;
  47.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top