示例#1
0
 /**
  * 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'))));
 }
示例#2
0
 /**
  * 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);
 }
示例#3
0
 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);
 }
示例#4
0
 /**
  * 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);
 }