当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_SubForm::isValid方法代码示例

本文整理汇总了PHP中Zend_Form_SubForm::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::isValid方法的具体用法?PHP Zend_Form_SubForm::isValid怎么用?PHP Zend_Form_SubForm::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_SubForm的用法示例。


在下文中一共展示了Zend_Form_SubForm::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValid

 /**
  * 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())
 {
     // "General" e-mail address is compulsory
     $this->getElement("emailGENERAL")->setRequired(true);
     // Call original isValid()
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:14,代码来源:EmailAddresses.php

示例2: isValid

 /**
  * 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())
 {
     $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
     // If correspondence address is set to be the same as insured address, copy the address values across
     if (isset($formData['cor_same_address']) && $formData['cor_same_address'] == 'yes') {
         // NOTE: THIS BIT OF CODE MEANS BOTH ADDRESS SUBFORMS MUST APPEAR ON THE SAME PAGE
         $formData['cor_house_number_name'] = $formData['ins_house_number_name'];
         $formData['cor_postcode'] = $formData['ins_postcode'];
         $formData['cor_address'] = $formData['ins_address'];
         $findPostcode = $formData['ins_postcode'];
     }
     // If a postcode is present, look it up and populate the allowed values of the associated dropdown
     if (isset($formData['cor_postcode']) && trim($formData['cor_postcode']) != '') {
         $postcode = trim($formData['cor_postcode']);
         $postcodeLookup = new Manager_Core_Postcode();
         $addresses = $postcodeLookup->getPropertiesByPostcode(preg_replace('/[^\\w\\ ]/', '', $postcode));
         $addressList = array('' => '--- please select ---');
         foreach ($addresses as $address) {
             $addressList[$address['id']] = $address['singleLineWithoutPostcode'];
         }
         $cor_address = $this->getElement('cor_address');
         $cor_address->setMultiOptions($addressList);
         $validator = new Zend_Validate_InArray(array('haystack' => array_keys($addressList)));
         $validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Correspondence address does not match with postcode'));
         $cor_address->addValidator($validator, true);
     }
     // If a value for an address lookup is present, the house name or number is not required
     if (isset($formData['cor_postcode'])) {
         $this->getElement('cor_house_number_name')->setRequired(false);
     }
     // Call original isValid()
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:40,代码来源:CorrespondenceDetails.php

示例3: isValid

 /**
  * 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['need_contents_insurance']) && $formData['need_contents_insurance'] == 'yes') {
         // User wants contents insurance - so we need to know if the property is furnished
         $this->getElement('property_furnished')->setRequired(true);
         if (isset($formData['property_furnished']) && $formData['property_furnished'] == 'yes') {
             // User has said they want contents insurance and the property
             // is furnished - so we need to make the extra information mandatory
             $this->getElement('contents_amount')->setRequired(true);
             $this->getElement('contents_excess')->setRequired(true);
             $this->getElement('contents_accidental_damage')->setRequired(true);
         } else {
             // Property is unfurnished so we don't need to know any of the extra data
             $this->getElement('contents_amount')->setRequired(false);
             $this->getElement('contents_excess')->setRequired(false);
             $this->getElement('contents_accidental_damage')->setRequired(false);
             unset($formData['contents_amount']);
             unset($formData['contents_excess']);
             unset($formData['contents_accidental_damage']);
         }
     } else {
         // Make the extra data optional as they haven't said they want contents insurance
         $this->getElement('property_furnished')->setRequired(false);
         $this->getElement('contents_amount')->setRequired(false);
         $this->getElement('contents_excess')->setRequired(false);
         $this->getElement('contents_accidental_damage')->setRequired(false);
         unset($formData['contents_amount']);
         unset($formData['contents_excess']);
         unset($formData['contents_accidental_damage']);
     }
     // Call original isValid()
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:40,代码来源:ContentsInsurance.php

示例4: isValid

 public function isValid($formData = array())
 {
     if (isset($formData['ins_property_postcode']) && trim($formData['ins_property_postcode']) != '') {
         $postcode = trim($formData['ins_property_postcode']);
         $postcodeLookup = new Manager_Core_Postcode();
         $addresses = $postcodeLookup->getPropertiesByPostcode(preg_replace('/[^\\w\\ ]/', '', $postcode));
         $addressList = array('' => '--- please select ---');
         if (isset($postcode) && preg_match('/^IM|^GY|^JE/i', $postcode)) {
             return;
         } else {
             foreach ($addresses as $address) {
                 $addressList[$address['id']] = $address['singleLineWithoutPostcode'];
             }
         }
         $ins_address = $this->getElement('property_address');
         $ins_address->setMultiOptions($addressList);
         $validator = new Zend_Validate_InArray(array('haystack' => array_keys($addressList)));
         $validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Insured address does not match with postcode'));
         $ins_address->addValidator($validator, true);
     }
     // If a value for an address lookup is present, the house name or number is not required
     if (isset($formData['ins_property_postcode'])) {
         $this->getElement('property_number_name')->setRequired(false);
     }
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:26,代码来源:PropertyAddress.php

示例5: isValid

 public function isValid($postData)
 {
     $pageSession = new Zend_Session_Namespace('portfolio_insurance_quote');
     $customerReferenceNumber = $pageSession->CustomerRefNo;
     $propertyManager = new Manager_Insurance_Portfolio_Property();
     $propertyObjects = $propertyManager->fetchAllProperties($customerReferenceNumber);
     $propertyArray = $propertyObjects->toArray();
     $optionList = array('' => '--- please select ---');
     foreach ($propertyArray as $property) {
         $optionList[$property['id']] = $property['address1'] . " " . $property['address2'] . " " . $property['address3'] . " " . $property['postcode'];
     }
     // Get the subfoem element for property address that the bank may have interest in
     $propertyAddressSelect = $this->getElement('claim_property');
     $propertyAddressSelect->setMultiOptions($optionList);
     $validator = new Zend_Validate_InArray(array('haystack' => array_keys($optionList)));
     $validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Not in list'));
     $propertyAddressSelect->addValidator($validator, true);
     // Set the selected to 0
     $propertyAddressSelect->setValue('0');
     $claimTypeList = array('' => '--- please select ---');
     $claimTypesSelect = $this->getElement('claim_type');
     $claimTypes = new Datasource_Insurance_PreviousClaimTypes();
     $claimTypeObjects = $claimTypes->getPreviousClaimTypes(Model_Insurance_ProductNames::LANDLORDSPLUS);
     foreach ($claimTypeObjects as $ClaimType) {
         $claimTypeList[$ClaimType->getClaimTypeID()] = $ClaimType->getClaimTypeText();
     }
     $claimTypesSelect->setMultiOptions($claimTypeList);
     return parent::isValid($postData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:29,代码来源:Claims.php

示例6: isValid

 public function isValid($formData = array())
 {
     // Call original isValid() first before doing further validation checks
     //    $isValid=parent::isValid($formData);
     $auth = Zend_Auth::getInstance();
     $auth->setStorage(new Zend_Auth_Storage_Session('hl_connect'));
     // Get ASN from auth object
     $agentSchemeNumber = $auth->getStorage()->read()->agentschemeno;
     if ($formData['question1'] === 'yes') {
         $this->getElement('claiminfo')->setRequired(true);
     } else {
         $this->getElement('claiminfo')->setRequired(false);
     }
     if (isset($formData['email_address']) && trim($formData['email_address']) != '') {
         // The agent manager can throw execptions, for web use we need to treat them as invalid and return false
         $agentManager = new Manager_Core_Agent();
         $agentObj = $agentManager->getAgent($agentSchemeNumber);
         // Get referencing email address (Cat 2)
         $ref_email_address = $agentManager->getEmailAddressByCategory(2);
         // Referencing email address is not allowed
         if ($formData['email_address'] === $ref_email_address) {
             $this->getElement('email_address')->addError('Please provide Landlord email address.');
             $isValid = false;
         }
         // Confirmed email address filed value should be same as email address field value
         if (isset($formData['confirm_email_address']) && trim($formData['confirm_email_address']) != '') {
             if ($formData['email_address'] !== $formData['confirm_email_address']) {
                 $this->getElement('confirm_email_address')->addError('Invalid confirmed email address.');
                 $isValid = false;
             }
         }
     }
     //    return $isValid;
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:35,代码来源:Landlord.php

示例7: isValid

 public function isValid($formData = array())
 {
     $isValid = parent::isValid($formData);
     if ($formData['property_managed'] === 'Let Only') {
         $this->getElement('LL_Permission')->setRequired(true);
     } else {
         $this->getElement('LL_Permission')->setRequired(false);
     }
     /*
             $tenancyDate = new Zend_Date ($formData['tenancy_startdate']);
             $policyDate = new Zend_Date ($formData['policy_startdate']);
             $daysDiff = $policyDate->sub($tenancyDate)->toValue()/60/60/24;
             
             // Policy start date should be between 0 to max 14 days after the tenancy start date
             if ($daysDiff < 0 || $daysDiff > 14) {
                 $this->getElement('tenancy_startdate')->addError('Policy start date should be maximum 14 days after the tenancy start date');
                
                 $isValid=false;
             }
     */
     // Monthly rental amount cannot be greater than £2500 for reference type 'Other Credit Check' and 'Insight'
     if (($formData['type'] === 'Other Credit Check' || $formData['type'] === 'Insight') && $formData['property_rental'] > 2500) {
         $this->getElement('property_rental')->addError('Monthly rental amount cannot be greater than £2500 for the selected reference type');
         $isValid = false;
     }
     return $isValid;
     //return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:28,代码来源:Property.php

示例8: isValid

 public function isValid($formData = array())
 {
     // If a postcode is present, look it up and populate the allowed values of the associated dropdown
     if (isset($formData['postcode']) && trim($formData['postcode']) != '') {
         $postcode = trim($formData['postcode']);
         $postcodeLookup = new Manager_Core_Postcode();
         $addresses = $postcodeLookup->getPropertiesByPostcode(preg_replace('/[^\\w\\ ]/', '', $postcode));
         $addressList = array('' => '--- please select ---');
         foreach ($addresses as $address) {
             $addressList[$address['id']] = $address['singleLineWithoutPostcode'];
         }
         $address = $this->getElement('address');
         $address->setMultiOptions($addressList);
         $validator = new Zend_Validate_InArray(array('haystack' => array_keys($addressList)));
         $validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Address does not match with postcode'));
         $address->addValidator($validator, true);
     }
     // If a value for an address lookup is present, the house name or number is not required
     if (isset($formData['address_postcode']) && $formData['address_postcode'] != '') {
         $this->getElement('postcode')->setRequired(false);
         $this->getElement('address')->setRequired(false);
     }
     // Call original isValid()
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:25,代码来源:Address.php

示例9: isValid

 /**
  * 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())
 {
     // Get rental payment data
     $pageSession = new Zend_Session_Namespace('online_claims');
     $manager = new Manager_Insurance_RentGuaranteeClaim_RentalPayment();
     $paymentData = $manager->getRentalPayments($pageSession->ClaimReferenceNumber);
     // If there is not any stored due data, all fields are mandatory so we get at least one entry
     $noPaymentsDueEntered = true;
     if (count($paymentData['data']) > 0) {
         // Run through data present looking for payments due entered
         foreach ($paymentData['data'] as $payment) {
             if ($payment['date_due'] != 'N/A') {
                 $noPaymentsDueEntered = false;
                 break 1;
             }
         }
     }
     if ($noPaymentsDueEntered) {
         $this->getElement('date_due')->setRequired(true);
         $this->getElement('amount_due')->setRequired(true);
     }
     // If there is any partly entered data, all fields are mandatory
     if (isset($formData['date_due']) && $formData['date_due'] != '' || isset($formData['amount_due']) && $formData['amount_due'] != '') {
         $this->getElement('date_due')->setRequired(true);
         $this->getElement('amount_due')->setRequired(true);
     }
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:35,代码来源:RentalPaymentsDue.php

示例10: isValid

 public function isValid($formData)
 {
     if (parent::isValid($formData)) {
         return $this->checkReliantFields($formData);
     } else {
         return false;
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:8,代码来源:AddShowRebroadcastDates.php

示例11: isValid

 /**
  * 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())
 {
     $pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
     $session = new Zend_Session_Namespace('homelet_global');
     $agentSchemeNumber = $session->agentSchemeNumber;
     // Call original isValid()
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:15,代码来源:PolicyDetails.php

示例12: isValid

 public function isValid($postData)
 {
     // If is_associated is 1 then the 'associated_text' text field become required
     if ($postData['is_associated'] == 1) {
         $this->getElement('associated_text')->setRequired(true);
     }
     return parent::isValid($postData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:8,代码来源:PersonalDetails.php

示例13: isWhenFormValid

 public function isWhenFormValid($formData, $validateStartDate, $originalStartDate, $update, $instanceId)
 {
     if (parent::isValid($formData)) {
         return self::checkReliantFields($formData, $validateStartDate, $originalStartDate, $update, $instanceId);
     } else {
         return false;
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:8,代码来源:AddShowWhen.php

示例14: isValid

 /**
  * 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 there is any partly entered data, all fields are mandatory
     if (isset($formData['date_received']) && $formData['date_received'] != '' || isset($formData['amount_received']) && $formData['amount_received'] != '') {
         $this->getElement('date_received')->setRequired(true);
         $this->getElement('amount_received')->setRequired(true);
     }
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:16,代码来源:RentalPaymentsReceived.php

示例15: isValid

 public function isValid($formData)
 {
     if (isset($formData['need_prestige_rent_guarantee']) && $formData['need_prestige_rent_guarantee'] == 'yes') {
         $this->getElement('rent_amount')->setRequired(true);
     } else {
         $this->getElement('rent_amount')->setRequired(false);
     }
     return parent::isValid($formData);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:9,代码来源:PrestigeRentGuarantee.php


注:本文中的Zend_Form_SubForm::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。