setName('registration'); // $this->setAttrib('name', 'registration'); $this->setAttrib('enctype', 'multipart/form-data'); $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->AddFilter('Int'); // create registration form subforms $user = new Zend_Form_SubForm(); $user->addElements(array( $title = new Zend_Form_Element_Select('title', array( 'label' => 'Your Title ', 'value' => 'Mr', 'select' => 'Mr', 'multioptions' => array('Mr', 'Mrs', 'Dr', 'Professor', 'Company')) ), $first_name = new Zend_Form_Element_Text('first_name', array( 'required' => true, 'label' => 'First Name:', 'value' => 'first Name', 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'Alnum', array('Regex', false, array('/[a-zA-z0-9]+/', 'messages' => 'Please Enter First Name')) ), 'attribs' => array('class' => 'required', 'minlength' => '4', 'maxlength' => '20'), )), $last_name = new Zend_Form_Element_Text('last_name', array( 'required' => true, 'label' => 'Family Name:', 'value' => 'family name', 'filters' => array('StringTrim', 'StringToLower'), // 'validators' => array( // 'Alnum', // array('Regex', // array('/^[a-z][a-z0-9]{2,}$/', 'messages' => 'Please Enter Family Name')) // ), 'attribs' => array('class' => 'required', 'minlegth' => '4', 'maxlength' => '20'), )), $distributor_id = new Zend_Form_Element_Text('distributor_id', array( 'required' => false, 'label' => 'Distributor Referral:', 'value' => '123', 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'Alnum', array('Regex', false, array('/^([0-9]+)/', 'messages' => 'Invalid Distributor Referral id')) ), 'attribs' => array('minlength' => '1', 'maxlength' => '50'), )), )); $password = new Zend_Form_SubForm(); $password->addElements(array( $passwd = new Zend_Form_Element_Password('password', array( 'required' => true, 'label' => 'Password:', 'value' => '********', 'default' => '********', 'filters' => array(('StringTrim'),('StripTags')), 'validators' => array( 'NotEmpty', // array('StringLength', true, array(6)) ), 'attribs' => array('class' => 'required', 'minlength' => '6', 'maxlength' => '50'), )), )); $password2 = new Zend_Form_SubForm(); $password2->addElements(array( $passwd2 = new Zend_Form_Element_Password('password2', array( 'required' => true, 'label' => 'Confirm Password:', 'value' => '********', 'default' => '********', 'filters' => array(('StringTrim'),('StripTags')), 'validators' => array( 'NotEmpty', // array('StringLength', false, array(6)) ), 'attribs' => array('class' => 'required', 'minlength' => '4', 'maxlength' => '50'), )), )); // Create demographics sub form: given name, family name, and // location $demog = new Zend_Form_SubForm(); $demog->addElements(array( $country = new Zend_Form_Element_Select('country', array( 'label' => 'Country:', 'select' => 'Select Country', 'multioptions' => array('Select Country', 'Top' => array( "Austria" => " Austria ", "Brazil" => " Brazil ", "Germany" => " Germany ", "Kuwait" => " Kuwait ", "Monaco" => " Monaco ", "Oman" => " Oman ", "Panama" => " Panama ", "Russian Federation" => " Russian Federation ", "Saudi Arabia" => " Saudi Arabia ", "Switzerland" => " Switzerland ", "United Arab Emirates" => " United Arab Emirates ", "United Kingdom" => " United Kingdom ", "United States" => " United States "), 'Alphabetically' => array( "Afghanistan" => " Afghanistan ", "Albania" => " Albania ", "Algeria" => " Algeria ", "American Samoa" => " American Samoa ", "Andorra" => " Andorra ", "Angola" => " Angola ", "Anguilla" => " Anguilla ", "Antarctica" => " Antarctica ", "Antigua and Barbuda" => " Antigua and Barbuda ", "Argentina" => " Argentina ", "Armenia" => " Armenia ", "Aruba" => " Aruba ", "Australia" => " Australia ", "Austria" => " Austria ", "Azerbaijan" => " Azerbaijan ", "Bahamas" => " Bahamas ", "Bahrain" => " Bahrain ", "Bangladesh" => " Bangladesh ", "Barbados" => " Barbados ", "Belarus" => " Belarus ", "Belgium" => " Belgium ", "Belize" => " Belize ", "Benin" => " Benin ", "Bermuda" => " Bermuda ", "Bhutan" => " Bhutan ", "Bolivia" => " Bolivia ", "Bosnia and Herzegovina" => " Bosnia and Herzegovina ", "Botswana" => " Botswana ", "Bouvet Island" => " Bouvet Island ", "Brazil" => " Brazil ", "British Indian Ocean Territory" => " British Indian Ocean Territory ", "Brunei Darussalam" => " Brunei Darussalam ", "Bulgaria" => " Bulgaria ", "Burkina Faso" => " Burkina Faso ", "Burundi" => " Burundi ", "Cambodia" => " Cambodia ", "Cameroon" => " Cameroon ", "Canada" => " Canada ", "Cape Verde" => " Cape Verde ", "Cayman Islands" => " Cayman Islands ", "Central African Republic" => " Central African Republic ", "Chad" => " Chad ", "Chile" => " Chile ", "China" => " China ", "Christmas Island" => " Christmas Island ", "Cocos (Keeling) Islands" => " Cocos (Keeling) Islands ", "Colombia" => " Colombia ", "Comoros" => " Comoros ", "Congo" => " Congo ", "Congo, The Democratic Republic of The" => " Congo, The Democratic Republic of The ", "Cook Islands" => " Cook Islands ", "Costa Rica" => " Costa Rica ", "Cote D'ivoire" => " Cote D'ivoire ", "Croatia" => " Croatia ", "Cuba" => " Cuba ", "Cyprus" => " Cyprus ", "Czech Republic" => " Czech Republic ", "Denmark" => " Denmark ", "Djibouti" => " Djibouti ", "Dominica" => " Dominica ", "Dominican Republic" => " Dominican Republic ", "Ecuador" => " Ecuador ", "Egypt" => " Egypt ", "El Salvador" => " El Salvador ", "Equatorial Guinea" => " Equatorial Guinea ", "Eritrea" => " Eritrea ", "Estonia" => " Estonia ", "Eritrea" => " Eritrea ", "Estonia" => " Estonia ", "Ethiopia" => " Ethiopia ", "Falkland Islands (Malvinas)" => " Falkland Islands (Malvinas) ", "Faroe Islands" => " Faroe Islands ", "Fiji" => " Fiji ", "Finland" => " Finland ", "France" => " France ", "French Guiana" => " French Guiana ", "French Polynesia" => " French Polynesia ", "French Southern Territories" => " French Southern Territories ", "Gabon" => " Gabon ", "Gambia" => " Gambia ", "Georgia" => " Georgia ", "Germany" => " Germany ", "Ghana" => " Ghana ", "Gibraltar" => " Gibraltar ", "Greece" => " Greece ", "Greenland" => " Greenland ", "Grenada" => " Grenada ", "Guadeloupe" => " Guadeloupe ", "Guam" => " Guam ", "Guatemala" => " Guatemala ", "Guinea" => " Guinea ", "Guinea-bissau" => " Guinea-bissau ", "Guyana" => " Guyana ", "Haiti" => " Haiti ", "Heard Island and Mcdonald Islands" => " Heard Island and Mcdonald Islands ", "Holy See (Vatican City State)" => " Holy See (Vatican City State) ", "Honduras" => " Honduras ", "Hong Kong" => " Hong Kong ", "Hungary" => " Hungary ", "Iceland" => " Iceland ", "India" => " India ", "Indonesia" => " Indonesia ", "Iran" => " Iran ", "Iraq" => " Iraq ", "Ireland" => " Ireland ", "Israel" => " Israel ", "Italy" => " Italy ", "Jamaica" => " Jamaica ", "Japan" => " Japan ", "Jordan" => " Jordan ", "Kazakhstan" => " Kazakhstan ", "Kenya" => " Kenya ", "Kiribati" => " Kiribati ", "Kuwait" => " Kuwait ", "Kyrgyzstan" => " Kyrgyzstan ", "Lao People's Democratic Republic" => " Lao People's Democratic Republic ", "Latvia" => " Latvia ", "Lebanon" => " Lebanon ", "Lesotho" => " Lesotho ", "Liberia" => " Liberia ", "Libyan Arab Jamahiriya" => " Libyan Arab Jamahiriya ", "Liechtenstein" => " Liechtenstein ", "Lithuania" => " Lithuania ", "Luxembourg" => " Luxembourg ", "Macao" => " Macao ", "Macedonia" => " Macedonia ", "Madagascar" => " Madagascar ", "Malawi" => " Malawi ", "Malaysia" => " Malaysia ", "Maldives" => " Maldives ", "Mali" => " Mali ", "Malta" => " Malta ", "Marshall Islands" => " Marshall Islands ", "Martinique" => " Martinique ", "Mauritania" => " Mauritania ", "Mauritius" => " Mauritius ", "Mayotte" => " Mayotte ", "Mexico" => " Mexico ", "Micronesia, Federated States of" => " Micronesia, Federated States of ", "Moldova" => " Moldova ", "Monaco" => " Monaco ", "Mongolia" => " Mongolia ", "Montserrat" => " Montserrat ", "Montenegro" => " Montenegro", "Morocco" => " Morocco ", "Mozambique" => " Mozambique ", "Myanmar" => " Myanmar ", "Namibia" => " Namibia ", "Nauru" => " Nauru ", "Nepal" => " Nepal ", "Netherlands" => " Netherlands ", "Netherlands Antilles" => " Netherlands Antilles ", "New Caledonia" => " New Caledonia ", "New Zealand" => " New Zealand ", "Nicaragua" => " Nicaragua ", "Niger" => " Niger ", "Nigeria" => " Nigeria ", "Niue" => " Niue ", "Norfolk Island" => " Norfolk Island ", "North Korea" => " North Korea ", "Northern Mariana Islands" => " Northern Mariana Islands ", "Norway" => " Norway ", "Oman" => " Oman ", "Pakistan" => " Pakistan ", "Palau" => " Palau ", "Palestinian Territory, Occupied" => " Palestinian Territory, Occupied ", "Panama" => " Panama ", "Papua New Guinea" => " Papua New Guinea ", "Paraguay" => " Paraguay ", "Peru" => " Peru ", "Philippines" => " Philippines ", "Pitcairn" => " Pitcairn ", "Poland" => " Poland ", "Portugal" => " Portugal ", "Puerto Rico" => " Puerto Rico ", "Qatar" => " Qatar ", "Reunion" => " Reunion ", "Romania" => " Romania ", "Russian Federation" => " Russian Federation ", "Rwanda" => " Rwanda ", "Saint Helena" => " Saint Helena ", "Saint Kitts and Nevis" => " Saint Kitts and Nevis ", "Saint Lucia" => " Saint Lucia ", "Saint Pierre and Miquelon" => " Saint Pierre and Miquelon ", "Saint Vincent and The Grenadines" => " Saint Vincent and The Grenadines ", "Samoa" => " Samoa ", "San Marino" => " San Marino ", "Sao Tome and Principe" => "Sao Tome and Principe", "Saudi Arabia" => " Saudi Arabia ", "Senegal" => " Senegal ", "Serbia" => " Serbia ", "Seychelles" => " Seychelles ", "South Georgia and The South Sandwich Islands" => " SGSSI ", "South Korea" => " South Korea ", "Sierra Leone" => " Sierra Leone ", "Singapore" => " Singapore ", "Slovakia" => " Slovakia ", "Slovenia" => " Slovenia ", "Solomon Islands" => "Solomon Islands ", "Somalia" => " Somalia ", "South Africa" => "South Africa", "Spain" => "Spain", "Sri Lanka" => "Sri Lanka", "Sudan" => "Sudan", "Suriname" => "Suriname", "Svalbard and Jan Mayen" => "Svalbard and Jan Mayen", "Swaziland" => " Swaziland ", "Sweden" => " Sweden", "Switzerland" => "Switzerland ", "Syrian Arab Republic" => "Syrian Arab Republic", "Taiwan" => "Taiwan", "Tajikistan" => "Tajikistan", "Tanzania" => "Tanzania", "Thailand" => "Thailand", "Timor-leste" => "Timor-leste", "Togo" => "Togo", "Tokelau" => "Tokelau", "Tonga" => "Tonga", "Trinidad and Tobago" => "Trinidad and Tobago", "Tunisia" => "Tunisia", "Turkey" => "Turkey", "Turkmenistan" => "Turkmenistan", "Turks and Caicos Islands" => "Turks and Caicos Islands", "Tuvalu" => "Tuvalu", "Uganda" => "Uganda", "Ukraine" => "Ukraine", "United Arab Emirates" => "United Arab Emirates", "United Kingdom" => "United Kingdom", "United States" => "United States", "United States Minor Outlying Islands" => "United States Minor Outlying Islands", "Uruguay" => "Uruguay", "Uzbekistan" => "Uzbekistan", "Vanuatu" => "Vanuatu", "Venezuela" => "Venezuela", "Viet Nam" => "Viet Nam", "Virgin Islands, British" => "Virgin Islands, British", "Virgin Islands, U.S." => "Virgin Islands, U.S.", "Wallis and Futuna" => "Wallis and Futuna", "Western Sahara" => "Western Sahara", "Yemen" => "Yemen", "Zambia" => "Zambia", "Zimbabwe" => "Zimbabwe"), )) ), $city = new Zend_Form_Element_Text('city', array( 'required' => true, 'label' => 'City:', 'value' => 'city', 'filters' => array('StringTrim'), 'validators' => array( array('Regex', false, array('/[A-Za-z\s]+/', 'messages' => 'Invalid City Passed')) ) )), )); // Create mailing lists sub form $accept_disclaimerOptions = "I have read, understood and agree to these rules and conditions "; $risk_statement_text = "Risk Statement and Distributor profile conditions:

Please read and accept Loan Conservator's"; $risk_statement_link = Zend_Registry::get('Config')->url->loan_agreement; $risk_statement_link = " risk statement here "; // $risk_statement_profile_conditions = 'and our distributors profile conditions here '; // $risk_statement_full = "$risk_statement_text" . "$risk_statement_link" . "$risk_statement_profile_conditions"; $risk_statement_full = "$risk_statement_text" . "$risk_statement_link"; $accept_disclaimer = new Zend_Form_SubForm(); $accept_disclaimer->addElements(array( $disclaimer = new Zend_Form_Element_Checkbox('accept_disclaimer', array( 'required' => true, 'label' => "$risk_statement_full", 'description' => $accept_disclaimerOptions, 'uncheckedvalue' => '', 'checkedvalue' => '0', 'value' => 1, )), )); $disclaimer->setDecorators(array( 'ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('Label', array('escape' => false, 'tag' => 'dt')), array('HtmlTag', array('tag' => 'dd')), 'Errors', )); // email validator currently not validating against emails $email = new Zend_Form_SubForm(); $email->addElements(array( $email_addr = new Zend_Form_Element_Text('email', array( 'required' => true, 'label' => 'Email:', 'value' => 'email (Gmail, Yahoo, etc.)', 'filters' => array('StringTrim','StripTags'), 'validators' => array('EmailAddress','NotEmpty','Db_NoRecordExists' => array('options' => array('table' => 'lc_users_info', field => 'email'))), 'attribs' => array('minlength' => '5', 'maxlength' => '40'), )); $contact_info = new Zend_Form_SubForm(); $contact_info->addElements(array( $post_code = new Zend_Form_Element_Text('post_code', array( 'required' => true, 'label' => 'ZIP / Post code:', 'value' => 'zip/post code', 'filters' => array('StringTrim', 'Striptags'), 'validators' => array( array('Regex', false, array('/[0-9]+/', 'messages' => 'Invalid post code')) ), 'attribs' => array('class' => 'required', 'minlength' => '2', 'maxlength' => '30'), )), $full_address = new Zend_Form_Element_Text('full_address', array( 'required' => true, 'label' => 'Street:', 'value' => 'street', 'filters' => array('StringTrim', 'Striptags'), 'validators' => array( array('Regex', false, array('/[a-zA-z0-9]+/', 'messages' => 'Invalid Address value')) ), 'attribs' => array('class' => 'required', 'minlength' => '4', 'maxlength' => '80'), )), $house_number = new Zend_Form_Element_Text('house_number', array( 'required' => true, 'label' => 'House Number:', 'value' => 'house number', 'filters' => array('StringTrim', 'Striptags'), 'validators' => array( array('Regex', false, array('/^([0-9]+)/i', 'messages' => 'Invalid House Number')) ), 'attribs' => array('class' => 'required', 'minlength' => '1', 'maxlength' => '80'), )), $phone_number = new Zend_Form_Element_Text('phonenumber', array( 'label' => 'Telephone:', 'value' => 'phone number', 'required' => true, 'validators' => array( array('Regex', false, array('/^\+{1}[0-9]{9,15}$/', 'messages' => 'Please Enter a Valid International Phone Number! Example: +35958604088')) ), 'attribs' => array('class' => 'required', 'minlength' => '6', 'maxlength' => '50'), )), $birth_date = new ZendX_JQuery_Form_Element_DatePicker('birth_date',array( 'label' => 'Date of Birth', 'value' => 'date of birth', 'jQueryParams' => array('dateFormat' => 'dd-mm-yy'))), )); $personal_file_info = new Zend_Form_SubForm(); $personal_file_info->addElements(array( $file_copy_of_passport = new Zend_Form_Element_File('file_copy_of_passport', array( 'required' => true, 'label' => 'Copy of passport:', 'value' => 'copy of passport', 'destionation' => '/tmp', // limit file size to 10 MB 'validators' => array( array('Size', false, 10240000)) )), $file_cv = new Zend_Form_Element_File('file_cv', array( 'label' => 'CV:', 'value' => 'CV', 'destionation' => '/tmp', // limit file size to 10 MB 'validators' => array( array('Size', false, 10240000)) )), )); $register = new Zend_Form_SubForm(); $register->addElements(array( new Zend_Form_Element_Submit('Register', array( 'label' => 'Register', 'ignore' => 'True') ), )); // Attach sub forms to main form $this->addSubForms(array( 'id' => $id, 'user' => $user, 'email' => $email, 'password' => $password, 'password2' => $password2, 'demog' => $demog, 'contact_info' => $contact_info, 'personal_file_info' => $personal_file_info, 'accept_disclaimer' => $accept_disclaimer, 'register' => $register, )); // add
decorators to the form $subforms_arr = array( "title" => $title, "first_name" => $first_name, "last_name" => $last_name, "distributor_id" => $distributor_id, "passwd" => $passwd, "passwd2" => $passwd2, "country" => $country, "city" => $city, "disclaimer" => $disclaimer, "email_addr" => $email_addr, "post_code" => $post_code, "full_address" => $full_address, "house_number" => $phone_number, "file_copy_of_passport" => $file_copy_of_passport, "file_cv" => $file_cv, "register" => $register ); // loop through all objects and create new div decorators foreach ($subforms_arr as $key => $decor) { $decor->addDecorator(array( 'data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'label', 'name' => $key)); $decorators = $decor->getDecorator('data'); } } } ?>