function __construct($controller, $name, $use_actions = true)
 {
     $fields = new FieldList();
     //point of contact
     $fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
     $fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
     //main info
     $fields->push($title = new TextField('title', 'Title'));
     $fields->push($url = new TextField('url', 'Url'));
     $fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
     $fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
     $ddl_type->setEmptyString("--SELECT A JOB TYPE --");
     $fields->push($description = new HtmlEditorField('description', 'Description'));
     $fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
     $fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
     $fields->push($company = new CompanyField('company', 'Company'));
     $point_of_contact_name->addExtraClass('job_control');
     $point_of_contact_email->addExtraClass('job_control');
     $title->addExtraClass('job_control');
     $url->addExtraClass('job_control');
     $description->addExtraClass('job_control');
     $instructions->addExtraClass('job_control');
     $expiration_date->addExtraClass('job_control');
     $company->addExtraClass('job_control');
     //location
     $ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
     $ddl_locations->addExtraClass('location_type');
     $ddl_locations->addExtraClass('job_control');
     $fields->push($ddl_locations);
     $fields->push($city = new TextField('city', 'City'));
     $fields->push($state = new TextField('state', 'State'));
     $fields->push($country = new CountryDropdownField('country', 'Country'));
     $city->addExtraClass('physical_location');
     $state->addExtraClass('physical_location');
     $country->addExtraClass('physical_location');
     // Guard against automated spam registrations by optionally adding a field
     // that is supposed to stay blank (and is hidden from most humans).
     // The label and field name are intentionally common ("username"),
     // as most spam bots won't resist filling it out. The actual username field
     // on the forum is called "Nickname".
     $fields->push(new TextField('user_name', 'UserName'));
     // Create action
     $actions = new FieldList();
     if ($use_actions) {
         $actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
     }
     // Create validators
     $validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
     $this->addExtraClass('job-registration-form');
     $this->addExtraClass('input-form');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 function testFieldHasExtraClass()
 {
     /* TextField has an extra class name and is in the HTML the field returns */
     $textField = new TextField('Name');
     $textField->addExtraClass('thisIsMyClassNameForTheFormField');
     preg_match('/thisIsMyClassNameForTheFormField/', $textField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyClassNameForTheFormField');
     /* EmailField has an extra class name and is in the HTML the field returns */
     $emailField = new EmailField('Email');
     $emailField->addExtraClass('thisIsMyExtraClassForEmailField');
     preg_match('/thisIsMyExtraClassForEmailField/', $emailField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyExtraClassForEmailField');
     /* OptionsetField has an extra class name and is in the HTML the field returns */
     $optionsetField = new OptionsetField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)');
     $optionsetField->addExtraClass('thisIsMyExtraClassForOptionsetField');
     preg_match('/thisIsMyExtraClassForOptionsetField/', $optionsetField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyExtraClassForOptionsetField');
 }
 function __construct($controller, $name)
 {
     // Name Set
     $FirstNameField = new TextField('FirstName', 'First Name');
     $FirstNameField->addExtraClass('input-text');
     $LastNameField = new TextField('LastName', 'Last Name');
     $LastNameField->addExtraClass('input-text');
     // Email
     $EmailAddressField = new EmailField('EmailAddress', 'Email Address');
     $EmailAddressField->addExtraClass('input-text');
     $fields = new FieldList($FirstNameField, $LastNameField, $EmailAddressField);
     $actions = new FieldList(new FormAction('doSigninForm', 'Sign Up'));
     parent::__construct($controller, $name, $fields, $actions);
     // Create Validators
     $validator = new RequiredFields('FirstName');
     $validator = new RequiredFields('LastName');
     $validator = new RequiredFields('EmailAddress');
     $this->disableSecurityToken();
 }
 function ContactForm()
 {
     error_log("Render form");
     $name = _t('ContactPage.NAME', 'Name');
     $email = _t('ContactPage.EMAIL', 'Email');
     $comments = _t('ContactPage.COMMENTS', 'Comments');
     $send = _t('ContactPage.SEND', 'Send');
     // Create fields
     $tf = new TextField('Name', $name);
     $tf->addExtraClass('span11');
     $ef = new EmailField('Email', $email);
     $ef->addExtraClass('span11');
     $taf = new TextareaField('Comments', $comments);
     $taf->addExtraClass('span11');
     $fields = new FieldList($tf, $ef, $taf);
     // Create action
     $fa = new FormAction('SendContactForm', $send);
     // for bootstrap
     $fa->useButtonTag = true;
     $fa->addExtraClass('btn btn-primary');
     $actions = new FieldList($fa);
     // Create action
     $validator = new RequiredFields('Name', 'Email', 'Comments');
     $form = new Form($this, 'ContactForm', $fields, $actions, $validator);
     $form->setTemplate('VerticalForm');
     $form->addExtraClass('well');
     return $form;
 }