function MobileRegistrationForm($membership) { //Membership $membershipField = new HiddenField('MembershipType', null, $membership); // Name Set $FirstNameField = new TextField('FirstName', "First Name"); $LastNameField = new TextField('Surname', "Last Name"); // Country $label = _t('Addressable.COUNTRY', 'Country'); $countryField = new CountryDropdownField('Country', $label); $countryField->setEmptyString('-- Select One --'); $countryField->addExtraClass('chzn-select'); // Email Addresses $PrimaryEmailField = new TextField('Email', "Primary Email Address"); $fields = new FieldList($membershipField, $FirstNameField, $LastNameField, $countryField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('login_text', '<div class="login_lit"> You will use this to login. </div>')); $fields->push(new ConfirmedPasswordField('Password', 'Password')); $actions = new FieldList(new FormAction('doRegisterMobile', 'Complete Registration')); $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'Country', 'Password'); $form = new HoneyPotForm($this, 'MobileRegistrationForm', $fields, $actions, $validator); if ($data = Session::get("FormInfo.{$form->FormName()}.data")) { return $form->loadDataFrom($data); } return $form; }
function RegistrationForm() { // Name Set $FirstNameField = new TextField('FirstName', "First Name"); $LastNameField = new TextField('Surname', "Last Name"); // Email Addresses $PrimaryEmailField = new TextField('Email', "Primary Email Address"); // New Gender Field $GenderField = new OptionSetField('Gender', 'I identify my gender as:', array('Male' => 'Male', 'Female' => 'Female', 'Specify' => 'Let me specify', 'Prefer not to say' => 'Prefer not to say')); $GenderSpecifyField = new TextField('GenderSpecify', 'Specify your gender'); $GenderSpecifyField->addExtraClass('hide'); $StatementOfInterestField = new TextField('StatementOfInterest', 'Statement of Interest'); $StatementOfInterestField->addExtraClass('autocompleteoff'); $affiliations = new AffiliationField('Affiliations', 'Affiliations'); $affiliations->setMode('local'); $fields = new FieldList($FirstNameField, $LastNameField, new LiteralField('break', '<hr/>'), $PrimaryEmailField, new LiteralField('instructions', '<p>This will also be your login name.</p>'), new LiteralField('break', '<hr/>'), $GenderField, $GenderSpecifyField, new LiteralField('instructions', '<p>It\'s perfectly acceptable if you choose not to tell us: we appreciate you becoming a member of OpenStack Foundation. The information will remain private and only used to monitor our effort to improve gender diversity in our community.</p>'), new LiteralField('break', '<hr/>'), $affiliations, $StatementOfInterestField, new LiteralField('instructions', '<p>Your statement of interest should be a few words describing your objectives or plans for OpenStack.</p>'), new LiteralField('break', '<hr/>'), new TextField('Address', _t('Addressable.ADDRESS', 'Street Address (Line1)')), new TextField('Suburb', _t('Addressable.SUBURB', 'Street Address (Line2)')), new TextField('City', _t('Addressable.CITY', 'City'))); $label = _t('Addressable.STATE', 'State'); if (is_array($this->allowedStates)) { $fields->push(new DropdownField('State', $label, $this->allowedStates)); } elseif (!is_string($this->allowedStates)) { $fields->push(new TextField('State', $label)); } $AdressField = new TextField('Postcode', _t('Addressable.POSTCODE', 'Postcode')); $fields->push($AdressField); $label = _t('Addressable.COUNTRY', 'Country'); if (is_array($this->allowedCountries)) { $countryField = new DropdownField('Country', $label, $this->allowedCountries); $countryField->addExtraClass('chzn-select'); $countryField->setEmptyString('-- Select One --'); $fields->push($countryField); } elseif (!is_string($this->allowedCountries)) { $countryField = new CountryDropdownField('Country', $label); $countryField->setEmptyString('-- Select One --'); $countryField->addExtraClass('chzn-select'); $fields->push($countryField); } $fields->push(new LiteralField('break', '<hr/>')); $fields->push(new ConfirmedPasswordField('Password', 'Password')); $fields->push(new HiddenField('MembershipType', 'MembershipType', 'foundation')); $actions = new FieldList(new FormAction('doRegister', 'Submit My Application')); $validator = new Member_Validator('FirstName', 'Surname', 'Email', 'StatementOfInterest', 'Address', 'City', 'Country', 'Password'); $form = new HoneyPotForm($this, 'RegistrationForm', $fields, $actions, $validator); if ($data = Session::get("FormInfo.{$form->FormName()}.data")) { if (isset($data['HiddenAffiliations'])) { $affiliations->setValue($data['HiddenAffiliations']); } return $form->loadDataFrom($data); } return $form; }