Created
June 18, 2015 15:10
-
-
Save sminnee/9e5573e78254a5ca10a5 to your computer and use it in GitHub Desktop.
Job Application Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this to top of JobPage_Controller | |
private static $allowed_actions = array( | |
'ApplicationForm' | |
); | |
// Add this to the bottom of JobPage_Controller | |
public function ApplicationForm() { | |
$fields = FieldList::create( | |
TextField::create('Name', 'Full name'), | |
EmailField::create('Email', 'Email'), | |
PhoneNumberField::create('Phone', 'Contact phone number'), | |
DropdownField::create( | |
'JobID', | |
'Which job are you applying for?', | |
$this->AvailableJobs()->map('ID', 'Title') | |
)->setEmptyString('(Select)'), | |
TextareaField::create('Content', 'Enter your experience and skills') | |
); | |
$actions = FieldList::create( | |
FormAction::create('processApplication', 'Apply') | |
); | |
$validator = RequiredFields::create(array( | |
'Name', | |
'Email', | |
'Phone', | |
'JobID', | |
'Content' | |
)); | |
$form = Form::create( | |
$this, | |
'ApplicationForm', | |
$fields, | |
$actions, | |
$validator | |
); | |
return $form; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this below your job listings: | |
<h3>Apply for a job</h3> | |
$ApplicationForm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment