當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DropdownField::setCustomValidationMessage方法代碼示例

本文整理匯總了PHP中DropdownField::setCustomValidationMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP DropdownField::setCustomValidationMessage方法的具體用法?PHP DropdownField::setCustomValidationMessage怎麽用?PHP DropdownField::setCustomValidationMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DropdownField的用法示例。


在下文中一共展示了DropdownField::setCustomValidationMessage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addShippingAddressFields

 /**
  * Add fields for shipping address and required fields to the validator.
  * 
  * @param Array $fields Array of fields
  * @param OrderFormValidator $validator Checkout form validator
  */
 private function addShippingAddressFields(&$fields, &$validator)
 {
     $firstNameField = new TextField('Shipping[FirstName]', _t('CheckoutPage.FIRSTNAME', "First Name"));
     $firstNameField->addExtraClass('shipping-firstname');
     $firstNameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_FIRSTNAME', "Please enter a first name."));
     $surnameField = new TextField('Shipping[Surname]', _t('CheckoutPage.SURNAME', "Surname"));
     $surnameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_SURNAME', "Please enter a surname."));
     $addressField = new TextField('Shipping[Address]', _t('CheckoutPage.ADDRESS1', "Address 1"));
     $addressField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_ADDRESS', "Please enter an address."));
     $cityField = new TextField('Shipping[City]', _t('CheckoutPage.CITY', "City"));
     $cityField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_CITY', "Please enter a city."));
     $countryField = new DropdownField('Shipping[Country]', _t('CheckoutPage.COUNTRY', "Country"), Country::shipping_countries());
     $countryField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_COUNTRY', "Please enter a country."));
     if (!Member::currentUserID() && Geoip::$default_country_code) {
         $countryField->setValue(Geoip::$default_country_code);
     }
     $regions = Region::shipping_regions();
     $regionField = null;
     if (!empty($regions)) {
         $regionField = new RegionField('Shipping[Region]', _t('CheckoutPage.REGION', "Region"));
         $regionField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_REGION', "Please enter a country."));
     }
     $sameAddressField = new CheckboxField('ShipToBillingAddress', _t('CheckoutPage.SAME_ADDRESS', "to same address?"));
     $sameAddressField->addExtraClass('shipping-same-address');
     $shippingAddressFields = new CompositeField(new HeaderField(_t('CheckoutPage.SHIPPING_ADDRESS', "Shipping Address"), 3), $sameAddressField, $firstNameField, $surnameField, new TextField('Shipping[Company]', _t('CheckoutPage.COMPANY', "Company")), $addressField, new TextField('Shipping[AddressLine2]', _t('CheckoutPage.ADDRESS2', "Address 2")), $cityField, new TextField('Shipping[PostalCode]', _t('CheckoutPage.POSTAL_CODE', "Postal Code")), new TextField('Shipping[State]', _t('CheckoutPage.STATE', "State")), $countryField);
     if ($regionField) {
         $shippingAddressFields->push($regionField);
     }
     $shippingAddressFields->setID('ShippingAddress');
     $fields['ShippingAddress'][] = $shippingAddressFields;
     $validator->addRequiredField('Shipping[FirstName]');
     $validator->addRequiredField('Shipping[Surname]');
     $validator->addRequiredField('Shipping[Address]');
     $validator->addRequiredField('Shipping[City]');
     $validator->addRequiredField('Shipping[Country]');
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:42,代碼來源:CheckoutPage.php


注:本文中的DropdownField::setCustomValidationMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。