/** * Define the OC step4 form elements * * @return void */ public function init() { $this->setMethod('post'); // Set decorators $this->clearDecorators(); $this->setDecorators(array('Form')); $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors')); // Add confirmation element $this->addElement('checkbox', 'chk_confirm', array('required' => true, 'checkedValue' => '1', 'uncheckedValue' => null, 'style' => 'height:15px;width:15px;', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please tick confirm checkbox to submit')))))); // Add name element $this->addElement('text', 'doc_confirmation_agent_name', array('label' => 'Your name', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '100', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your name', 'notEmptyInvalid' => 'Please enter your name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Your name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))))); $this->addElement('select', 'landlord_proprietor_of_property', array('label' => 'Is the landlord the registered proprietor of the property (legal owner)?', 'required' => true, 'multiOptions' => array('' => 'Please select', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please specify whether your landlord is the registered proprietor of the property', 'notEmptyInvalid' => 'Please specify whether your landlord is the registered proprietor of the property')))))); // Add element for first declaration $this->addElement('checkbox', 'dec1_confirm', array('required' => true, 'checkedValue' => '1', 'uncheckedValue' => null, 'class' => 'larger-checkbox', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please tick to confirm that the documents are uploaded and accurate.')))))); // Add element for second declaration $this->addElement('checkbox', 'dec2_confirm', array('required' => true, 'checkedValue' => '1', 'uncheckedValue' => null, 'class' => 'larger-checkbox', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please tick to confirm you understand that making a fraudulent claim is a criminal offence.')))))); // Add the save & exit button $this->addElement('button', 'save_exit', array('ignore' => true, 'label' => 'Save & Exit ', 'onclick' => "window.location = '/rentguaranteeclaims/saveclaim';")); // Add the back button $this->addElement('button', 'back', array('ignore' => true, 'label' => 'Back ', 'onclick' => 'window.location="step3"')); // Add the next button $this->addElement('button', 'next', array('ignore' => true, 'label' => 'Submit Claim', 'onclick' => 'fnSubmitDocuments(2)')); $this->addElement('hidden', 'hd_type', array('value' => 2)); $next = $this->getElement('next'); $next->clearDecorators(); $next->setDecorators(array('ViewHelper')); $back = $this->getElement('back'); $back->clearDecorators(); $back->setDecorators(array('ViewHelper')); $saveExit = $this->getElement('save_exit'); $saveExit->clearDecorators(); $saveExit->setDecorators(array('ViewHelper')); $chkConfirm = $this->getElement('chk_confirm'); $chkConfirm->clearDecorators(); $chkConfirm->setDecorators(array('ViewHelper')); $dec1Confirm = $this->getElement('dec1_confirm'); $dec1Confirm->clearDecorators(); $dec1Confirm->setDecorators(array('ViewHelper')); $dec2Confirm = $this->getElement('dec2_confirm'); $dec2Confirm->clearDecorators(); $dec2Confirm->setDecorators(array('ViewHelper')); Application_Core_FormUtils::removeFormErrors($this); // Strip all tags to prevent XSS errors $this->setElementFilters(array('StripTags')); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguaranteeclaims/subforms/supporting-documents.phtml')))); }
/** * Define the OC step3 form elements * * @return void */ public function init() { $this->setMethod('post'); // Set up the 'not applicable' signifier $this->addElement('text', 'notApplicable'); $this->getElement('notApplicable')->setValue(Datasource_Insurance_RentGuaranteeClaim_RentalPayment::DATE_PAID_NOT_APPLICABLE); // Add additional Information element $this->addElement('textarea', 'additional_information', array('label' => '', 'required' => false, 'class' => 'additionalinfo fullwidth', 'rows' => '5', 'cols' => '77')); // Bank account details $this->addElement('text', 'dd_accountname', array('label' => 'Account name', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '45', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter bank account name', 'notEmptyInvalid' => 'Please enter bank account name')))))); $this->addElement('text', 'bank_account_number', array('label' => 'Account number', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '45', 'validators' => array(array('Digits', true, array('messages' => array('notDigits' => 'Bank account number must only contain numbers', 'digitsStringEmpty' => 'Please enter your bank account number'))), array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your bank account number'))), array('regex', true, array('pattern' => '/^\\d{8,}$/', 'messages' => 'Bank account number must contain at least eight digits'))))); $this->addElement('text', 'bank_sortcode_number', array('label' => 'Sort code', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '45', 'validators' => array(array('regex', true, array('pattern' => '/^[0-9\\-]*$/', 'messages' => 'Sort code must contain only numbers and hyphens')), array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your bank sort code'))), array('SortCode', true, array('messages' => array('inValid' => 'Unable to confirm the bank Sortcode')))))); $this->addSubForm(new Connect_Form_Subforms_RentGuaranteeClaims_RentalPaymentsDue(), 'subform_rentalpaymentsdue'); $this->addSubForm(new Connect_Form_Subforms_RentGuaranteeClaims_RentalPaymentsReceived(), 'subform_rentalpaymentsreceived'); // Set decorators $this->clearDecorators(); $this->setDecorators(array('Form')); $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors')); // Add the back button $this->addElement('button', 'back', array('type' => 'submit', 'ignore' => true, 'label' => 'Back')); // Add the next button $this->addElement('button', 'next', array('type' => 'submit', 'ignore' => true, 'label' => 'Continue to Step 4')); // Add the save & exit button $this->addElement('button', 'save_exit', array('ignore' => true, 'label' => 'Save & Exit ', 'onclick' => "window.location = '/rentguaranteeclaims/saveclaim';")); $next = $this->getElement('next'); $next->clearDecorators(); $next->setDecorators(array('ViewHelper')); $back = $this->getElement('back'); $back->clearDecorators(); $back->setDecorators(array('ViewHelper')); $saveExit = $this->getElement('save_exit'); $saveExit->clearDecorators(); $saveExit->setDecorators(array('ViewHelper')); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguaranteeclaims/subforms/additional-information-and-rental-payments.phtml')))); Application_Core_FormUtils::removeFormErrors($this); }
/** * Overridden isValid() method for pre-validation code * * @param array $formData data typically from a POST or GET request * @return bool */ public function isValid($formData = array()) { if (isset($formData['landlord_postcode']) && trim($formData['landlord_postcode']) != '') { Application_Core_FormUtils::getAddressByPostcode($this, $formData, trim($formData['landlord_postcode']), 'landlord_address', 'landlord_housename', 'landlord_street', 'landlord_town', 'landlord_city', 'landlord\'s'); } // Ensure that all of landlord1_name, landlord_company_name are mandatory if all empty, all non-mandatory otherwise if (isset($formData['landlord1_name']) && trim($formData['landlord1_name']) != '' || isset($formData['landlord_company_name']) && trim($formData['landlord_company_name']) != '') { // One or more of the fields have a value, make them all non-mandatory $this->getElement('landlord1_name')->setRequired(false); $this->getElement('landlord_company_name')->setRequired(false); } // Hide Errors Application_Core_FormUtils::removeFormErrors($this); // Call original isValid() return parent::isValid($formData); }
public function addTenants($formData) { for ($i = 1; $i <= $formData['total_tenants']; $i++) { // Tenant Name $this->addElement('text', 'tenant_name_' . $i, array('label' => 'Full name', 'required' => true, 'filters' => array('StringTrim'), 'maxlength' => '80', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant {$i}'s name", 'notEmptyInvalid' => "Please enter tenant {$i}'s name")))), 'onblur' => 'validateguarantor()')); // Tenant Home Telno $this->addElement('text', 'tenant_hometelno_' . $i, array('label' => 'Home telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant {$i}'s home telephone number", 'notEmptyInvalid' => "Please enter tenant {$i}'s home telephone number")))), 'onblur' => 'validateguarantor()')); // Tenant Work Telno $this->addElement('text', 'tenant_worktelno_' . $i, array('label' => 'Work telephone number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant {$i}'s work telephone number", 'notEmptyInvalid' => "Please enter tenant {$i}'s work telephone number")))), 'onblur' => 'validateguarantor()')); // Tenant Mobile Telno $this->addElement('text', 'tenant_mobiletelno_' . $i, array('label' => 'Mobile number', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant {$i}'s mobile telephone number", 'notEmptyInvalid' => "Please enter tenant {$i}'s mobile telephone number")))), 'onblur' => 'validateguarantor()')); if ($formData['tenant_mobiletelno_' . $i] == '' && $formData['tenant_hometelno_' . $i] == '') { $this->getElement('tenant_mobiletelno_' . $i)->setRequired(true); $this->getElement('tenant_hometelno_' . $i)->setRequired(true); } // Tenant Email $this->addElement('text', 'tenant_email_' . $i, array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'maxlength' => '50', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter tenant {$i}'s email address", 'notEmptyInvalid' => "Please enter tenant {$i}'s email address")))), 'onblur' => 'validateguarantor()')); // IRN $this->addElement('text', 'rg_policy_ref_' . $i, array('label' => "HomeLet reference number", 'required' => false, 'maxlength' => '10', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please enter our reference number for tenant {$i}", 'notEmptyInvalid' => "Please enter our reference number for tenant {$i}"))), array('regex', true, array('pattern' => '/\\d{7}/', 'messages' => "Our reference number for tenant {$i} must be at least seven digits long"))), 'onblur' => 'validateguarantor()')); // Tenants DOB $this->addElement('text', 'tenants_dob_' . $i, array('label' => "Date of Birth (DD/MM/YYYY)", 'required' => true, 'class' => "hasDatepicker", 'maxlength' => '10', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => "Please select tenant {$i}'s date of birth", 'notEmptyInvalid' => "Please select tenant {$i}'s date of birth"))), array('regex', true, array('pattern' => '/^\\d\\d\\/\\d\\d\\/\\d\\d\\d\\d$/', 'messages' => "Tenant {$i}'s date of birth incomplete"))), 'onblur' => 'validateguarantor()')); } // Hide errors Application_Core_FormUtils::removeFormErrors($this); }
/** * Helper function to populate the zend form elements with database data * * @param Zend_Form $pageForm form definition for this step * @param int $stepNum current step number * * @return void */ private function _formStepCommonPopulate($pageForm, $stepNum) { $pageSession = new Zend_Session_Namespace('online_claims'); // First of all check that this form should be viewable and the user isn't trying to skip ahead $this->view->stepNum = $stepNum; $this->view->stepMax = $this->_stepMax; // Check to see if the user is trying to skip ahead in the claim $tooFarAhead = false; $lastCompleted = 1; if ((!isset($pageSession->completed) || is_null($pageSession->completed)) && $stepNum != 1) { $tooFarAhead = true; $lastCompleted = 1; } elseif ($stepNum > 1) { // Check to see if any pages previous to the one the user's trying to get to are incomplete $tooFarAhead = false; for ($i = 1; $i < $stepNum; $i++) { if (!isset($pageSession->completed[$i]) || !$pageSession->completed[$i]) { $tooFarAhead = true; $lastCompleted = $i; break; } } } if ($tooFarAhead) { // Drop user onto page that needs completing $response = $this->getResponse(); $response->setRedirect('/rentguaranteeclaims/step' . $lastCompleted); $response->sendResponse(); return false; } $formData = array(); $agentManager = new Manager_Core_Agent(); $agentDetails = $agentManager->getAgent($this->_agentSchemeNumber); // Populate the agents details $formData['agent_schemenumber'] = $this->_agentSchemeNumber; $formData['agent_name'] = $agentDetails->getName(); $formData['agent_postcode'] = $agentDetails->contact[0]->address->getPostCode(); $formData['agent_housename'] = $agentDetails->contact[0]->address->getHouseName(); $agentStreet = $agentDetails->contact[0]->address->getAddressLine1(); if ($agentStreet) { $agentStreet .= $agentStreet . ', '; } $agentStreet .= $agentDetails->contact[0]->address->getAddressLine2(); $formData['agent_street'] = $agentStreet; $formData['agent_town'] = $agentDetails->contact[0]->address->getTown(); $phones = $agentDetails->contact[0]->phoneNumbers->getTelephone(); $formData['agent_telephone'] = $phones['telephone1']; $formData['agent_email'] = $agentManager->getEmailAddressByCategory(Model_Core_Agent_EmailMapCategory::GENERAL); $agentManager = new Manager_Core_Agent(); $statusAbr = $agentManager->getFsaStatusCode($this->_agentSchemeNumber); $formData['agent_ar_by_barbon'] = in_array($statusAbr, array('NAR', 'AR')) == true ? 'Yes' : 'No'; $formData['agent_dir_by_fca'] = in_array($statusAbr, array('DIR')) == true ? 'Yes' : 'No'; if (isset($pageSession->ClaimReferenceNumber)) { // Only populate from DB if we are in session and have a reference number $claimReferenceNumber = $pageSession->ClaimReferenceNumber; // Populate $formData with data from model, if available $claimManager = new Manager_Insurance_RentGuaranteeClaim_Claim(); $claim = $claimManager->getClaim($claimReferenceNumber, $this->_agentSchemeNumber); // Override agents data with data from claim if available if ($claim->getAgentHousename() != '') { $formData['agent_housename'] = $claim->getAgentHousename(); } if ($claim->getAgentStreet() != '') { $formData['agent_street'] = $claim->getAgentStreet(); } if ($claim->getAgentTown() != '') { $formData['agent_town'] = $claim->getAgentTown(); } if ($claim->getAgentPostcode() != '') { $formData['agent_postcode'] = $claim->getAgentPostcode(); } if ($claim->getAgentTelephone() != '') { $formData['agent_telephone'] = $claim->getAgentTelephone(); } if ($claim->getAgentEmail() != '') { $formData['agent_email'] = $claim->getAgentEmail(); } switch ($stepNum) { case 1: // You and your Landlord section $formData['agent_contact_name'] = $claim->getAgentContactName(); $formData['landlord1_name'] = $claim->getLandlord1Name(); $formData['landlord_company_name'] = $claim->getLandlordCompanyName(); $formData['landlord_postcode'] = $claim->getLandlordPostcode(); $formData['landlord_address_id'] = $claim->getLandlordAddressId(); $formData['landlord_address'] = $claim->getLandlordAddressId(); $formData['landlord_housename'] = $claim->getLandlordHouseName(); $formData['landlord_street'] = $claim->getLandlordStreet(); $formData['landlord_city'] = $claim->getLandlordCity(); $formData['landlord_town'] = $claim->getLandlordTown(); $formData['landlord_telephone'] = $claim->getLandlordTelephone(); $formData['landlord_email'] = $claim->getLandlordEmail(); $pageForm->isValid($formData); break; case 2: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { //set step2 identifier $pageSession->identifier[$stepNum] = true; // get tenant and property details $formData['housing_act_adherence'] = $claim->getHousingActAdherence(); $formData['tenancy_start_date'] = $claim->getTenancyStartDate(); $formData['tenancy_end_date'] = $claim->getTenancyEndDate(); $formData['original_cover_start_date'] = $claim->getOriginalCoverStartDate(); $formData['monthly_rent'] = $claim->getMonthlyRent(); $formData['tenancy_address_id'] = $claim->getTenancyAddressId(); $formData['tenancy_postcode'] = $claim->getTenancyPostcode(); $formData['tenancy_housename'] = $claim->getTenancyHouseName(); $formData['tenancy_street'] = $claim->getTenancyStreet(); $formData['tenancy_town'] = $claim->getTenancyTown(); $formData['tenancy_city'] = $claim->getTenancyCity(); $formData['tenancy_postcode'] = $claim->getTenancyPostcode(); $formData['tenancy_address'] = $claim->getTenancyAddress(); $formData['tenancy_housename'] = $claim->getTenancyHouseName(); $formData['tenancy_street'] = $claim->getTenancyStreet(); $formData['tenancy_town'] = $claim->getTenancyTown(); $formData['tenancy_city'] = $claim->getTenancyCity(); $formData['deposit_amount'] = $claim->getDepositAmount(); $formData['rent_arrears'] = $claim->getRentArrears(); $formData['tenant_vacated'] = $claim->getTenantVacated(); $formData['tenant_vacated_date'] = $claim->getTenantVacatedDate(); $formData['first_arrear_date'] = $claim->getFirstArrearDate(); $formData['deposit_received_date'] = $claim->getDepositReceivedDate(); $formData['recent_complaints'] = $claim->getRecentComplaints(); $formData['recent_complaints_further_details'] = $claim->getRecentComplaintsDetails(); $formData['policy_number'] = $claim->getPolicyNumber(); $formData['grounds_for_claim'] = $claim->getGroundsForClaim(); $formData['grounds_for_claim_further_details'] = $claim->getGroundsForClaimDetails(); $formData['arrears_at_vacant_possession'] = $claim->getArrearsAtVacantPossession(); $formData['tenantsforwarding_address_id'] = $claim->getTenantsForwardingAddressId(); $formData['tenantsforwarding_housename'] = $claim->getTenantsForwardingHouseName(); $formData['tenantsforwarding_street'] = $claim->getTenantsForwardingStreet(); $formData['tenantsforwarding_town'] = $claim->getTenantsForwardingTown(); $formData['tenantsforwarding_city'] = $claim->getTenantsForwardingCity(); $formData['tenantsforwarding_postcode'] = $claim->getTenantsForwardingPostcode(); $formData['tenant_occupation_confirmed_by_tel'] = $claim->getTenantsOccupationOfPropertyConfirmedByTel(); $formData['tenant_occupation_confirmed_by_tel_dateofcontact'] = $claim->getTenantsOccupationOfPropertyConfirmedByTelDate(); $formData['tenant_occupation_confirmed_by_tel_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByTelContact(); $formData['tenant_occupation_confirmed_by_email'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmail(); $formData['tenant_occupation_confirmed_by_email_dateofcontact'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmailDate(); $formData['tenant_occupation_confirmed_by_email_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByEmailContact(); $formData['tenant_occupation_confirmed_by_visit'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisit(); $formData['tenant_occupation_confirmed_by_visit_dateofvisit'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitDate(); $formData['tenant_occupation_confirmed_by_visit_individualattending'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitIndividual(); $formData['tenant_occupation_confirmed_by_visit_tenantname'] = $claim->getTenantsOccupationOfPropertyConfirmedByVisitContact(); $formData['section21_served'] = $claim->getS21NoticeServed(); $formData['section21_expiry'] = $claim->getS21NoticeExpiry(); $formData['section21_moneydepositreceived'] = $claim->getS21NoticeMoneyDepositReceived(); $formData['section21_money_held_under_tds_deposit_scheme'] = $claim->getS21NoticeMoneyDepositHeldUnderTdsScheme(); $formData['section21_tds_complied_with'] = $claim->getS21NoticeTdsCompliedWith(); $formData['section21_tds_prescribed_information_to_tenant'] = $claim->getS21NoticeTdsPrescribedToTenant(); $formData['section21_landlord_deposit_in_property_form'] = $claim->getS21NoticeLandlordDepositInPropertyForm(); $formData['section21_returned_at_notice_serve_date'] = $claim->getS21NoticePropertyReturnedAtNoticeServeDate(); $formData['section8_served'] = $claim->getS8NoticeServed(); $formData['section8_expiry'] = $claim->getS8NoticeExpiry(); $formData['section8_demand_letter_sent'] = $claim->getS8NoticeDemandLetterSent(); $formData['section8_over18_occupants'] = $claim->getS8NoticeOver18Occupants(); // get guarantor details $guarantorManager = new Manager_Insurance_RentGuaranteeClaim_Guarantor(); $getGuarantorInfo = $guarantorManager->getGuarantors($claimReferenceNumber); $formData['total_guarantors'] = count($getGuarantorInfo); $formData['totalguarantors'] = count($getGuarantorInfo); $createDynamicGuarantorElement = 1; foreach ($getGuarantorInfo as $setGuarantorInfo) { Application_Core_FormUtils::createManualAddressInput($pageForm, 'guarantor_housename_' . $createDynamicGuarantorElement, 'guarantor_street_' . $createDynamicGuarantorElement, 'guarantor_town_' . $createDynamicGuarantorElement, 'guarantor_city_' . $createDynamicGuarantorElement); $formData['guarantor_name_' . $createDynamicGuarantorElement] = $setGuarantorInfo['guarantor_name']; $formData['guarantor_hometelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['hometelno']; $formData['guarantor_worktelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['worktelno']; $formData['guarantor_mobiletelno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['mobiletelno']; $formData['guarantor_email_' . $createDynamicGuarantorElement] = $setGuarantorInfo['email']; $formData['guarantors_dob_' . $createDynamicGuarantorElement] = date('d/m/Y', strtotime($setGuarantorInfo['dob'])); $formData['guarantor_homeletrefno_' . $createDynamicGuarantorElement] = $setGuarantorInfo['homeletrefno']; $formData['guarantor_housename_' . $createDynamicGuarantorElement] = $setGuarantorInfo['house_name']; $formData['guarantor_street_' . $createDynamicGuarantorElement] = $setGuarantorInfo['street']; $formData['guarantor_town_' . $createDynamicGuarantorElement] = $setGuarantorInfo['town']; $formData['guarantor_city_' . $createDynamicGuarantorElement] = $setGuarantorInfo['city']; $formData['guarantor_postcode_' . $createDynamicGuarantorElement] = $setGuarantorInfo['postcode']; $formData['guarantor_address_' . $createDynamicGuarantorElement] = $setGuarantorInfo['address_id']; $createDynamicGuarantorElement++; } // get tenant details $tenantManager = new Manager_Insurance_RentGuaranteeClaim_Tenant(); $getTenantInfo = $tenantManager->getTenants($claimReferenceNumber); $formData['total_tenants'] = count($getTenantInfo); $formData['totaltenants'] = count($getTenantInfo); $createDynamicTenantElement = 1; foreach ($getTenantInfo as $setTenantInfo) { $formData['tenant_name_' . $createDynamicTenantElement] = $setTenantInfo['tenant_name']; $formData['tenant_hometelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_hometelno']; $formData['tenant_worktelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_worktelno']; $formData['tenant_mobiletelno_' . $createDynamicTenantElement] = $setTenantInfo['tenant_mobiletelno']; $formData['tenant_email_' . $createDynamicTenantElement] = $setTenantInfo['tenant_email']; $formData['tenants_dob_' . $createDynamicTenantElement] = date('d/m/Y', strtotime($setTenantInfo['tenant_dob'])); $formData['rg_policy_ref_' . $createDynamicTenantElement] = $setTenantInfo['rg_policy_ref']; $createDynamicTenantElement++; } $pageForm->isValid($formData); } break; case 3: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { //set step3 identifier $pageSession->identifier[$stepNum] = true; $formData['additional_information'] = $claim->getAdditionalInfo(); $formData['dd_accountname'] = $claim->getClaimPaymentBankAccountName(); $formData['bank_account_number'] = $claim->getClaimPaymentBankAccountNumber(); $formData['bank_sortcode_number'] = $claim->getClaimPaymentBankAccountSortCode(); } break; case 4: if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] || isset($pageSession->identifier[$stepNum]) && $pageSession->identifier[$stepNum]) { $pageSession->identifier[$stepNum] = true; $formData['doc_confirmation_agent_name'] = $claim->getDocConfirmationAgentName(); $formData['landlord_proprietor_of_property'] = $claim->getLandlordIsPropertyProprietor(); $formData['chk_confirm'] = $claim->getAuthorityConfirmed(); $formData['dec_confirm'] = $claim->getDeclarationConfirmed(); $formData['hd_type'] = $claim->getSubmittedToKeyHouse(); } break; } } else { // Not in session but there are some defaults we need to set for step 1 // TODO: Write the javascript better so we don't need to do fudges like this $this->view->headScript()->appendScript("var sharersAllowed = 0;"); } $pageForm->populate($formData); $this->view->sidebar = $this->view->partial('partials/rent-guarantee-claim-sidebar.phtml', array('stepNum' => $stepNum, 'stepMax' => $this->_stepMax)); return true; }