Advertisement
Guest User

Untitled

a guest
Dec 25th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. // Controller
  2. class ContactUs_Controller extends Page_Controller {
  3.  
  4.     private static $allowed_actions = array('Form');
  5.  
  6.     public function Form() {
  7.  
  8.         // https://docs.silverstripe.org/en/3/developer_guides/forms/how_tos/simple_contact_form/
  9.         $fields = new FieldList(
  10.             new TextField('FirstName', 'Firs tName'),
  11.             new TextField('LastName', 'Last Name'),
  12.             new EmailField('Email', 'Email'),
  13.             new TextareaField('Message', 'Message')
  14.         );
  15.         $actions = new FieldList(
  16.             new FormAction('submit', 'Submit')
  17.         );
  18.  
  19.         $form = new Form($this, 'Form', $fields, $actions);
  20.         $form->setTemplate('ContactUsFormTemplate');
  21.  
  22.         return $form;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement