本文整理汇总了PHP中Zend_Form_Element_Text::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::setName方法的具体用法?PHP Zend_Form_Element_Text::setName怎么用?PHP Zend_Form_Element_Text::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
//parent::__construct($options);
$this->setName('addnewdevotee')->setAttrib('id', 'addnewdevotee')->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
//SUB FORM for Preliminary Information aboout Devotee
$SubForm_BasicInfo = new Zend_Form_SubForm();
$DevPic = new Zend_Form_Element_File('uplphoto');
$DevPic->setLabel('Upload Your Photo Here')->setName('uplphoto');
$path = 'photos/';
$DevPic->setDestination($path)->addValidator('Size', true, array('max' => '4096000', 'messages' => 'The maximum permitted image file size is %max% selected image file size is %size%.'))->addValidator('Extension', true, array('jpg,jpeg', 'messages' => 'photo with only jpg, jpeg or gif format
are accepted for uploading profile.'));
//->setRequired(true)
//->addValidator('NotEmpty');
//->setValidators(array('Size'=>array('min' => 20,'max' =>2097152),'Count' =>array('min' => 1,'max' => 3)))
//->addValidator('IsImage');
//to disable the viewrenderer use
//$this->_helper->viewRenderer->setNoRender(true);
$Fname = new Zend_Form_Element_Text('first_name');
$Fname->setLabel('First Name*')->setName('first_name')->setAttrib('placeholder', 'First Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Mname = new Zend_Form_Element_Text('middle_name');
$Mname->setLabel('Middle Name*')->setName('middle_name')->setAttrib('placeholder', 'Middle Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Lname = new Zend_Form_Element_Text('last_name');
$Lname->setLabel('Last Name*')->setName('last_name')->setAttrib('placeholder', 'Last Name')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Day = new Zend_Form_Element_Select('day');
$Day->setLabel('Date of Birth*')->setName('day')->setRequired(true)->setMultiOptions(Rgm_Basics::getDates())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Month = new Zend_Form_Element_Select('month');
$Month->setName('month')->setRequired(true)->setMultiOptions(Rgm_Basics::getMonths())->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Year = new Zend_Form_Element_Select('year');
$Year->setName('year')->setRequired(true)->setMultiOptions(Rgm_Basics::getYears(1912, 2012))->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim'));
$Gender = new Zend_Form_Element_Radio('gender');
$Gender->setName('gender')->setLabel('Gender*')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(true)->setMultiOptions(array('M' => 'Male', 'F' => 'Female'))->setSeparator('')->addFilters(array('StripTags', 'StringTrim'));
$centr = new Application_Model_DbTable_MstCenter();
$CenterOptions = $centr->getKeyValues();
$Center = new Zend_Form_Element_Select('center');
$Center->setName('center')->setLabel('Center*')->setMultiOptions($CenterOptions)->setRequired(false)->addValidator('NotEmpty');
$con = new Application_Model_DbTable_MstCounselor();
$Counselor = new Zend_Form_Element_Select('counselor');
$CounselorOptions = $con->getKeyValues();
$Counselor->setName('counselor')->setMultiOptions($CounselorOptions)->setLabel('Counselor')->setRequired(false)->addValidator('NotEmpty')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$mentr = new Application_Model_DbTable_MstAstCounselor();
$MentorOptions = $mentr->getKeyValues();
$Mentor = new Zend_Form_Element_Select('mentor');
$Mentor->setName('mentor')->setLabel('Mentor')->setMultioptions($MentorOptions)->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->setRequired(false)->addValidator('NotEmpty')->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$Mobile = new Zend_Form_Element_Text('mobile');
$Mobile->setName('mobile')->setLabel('Mobile No')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addValidator(new Rgm_Validate_MobileNumber())->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)));
$CC = new Application_Model_DbTable_MstCountry();
$CCOptions = $CC->getPairWithTelCode();
$CountryCode = new Zend_Form_Element_Select('cc');
$CountryCode->setName('cc')->setLabel('Country Code*')->setMultiOptions($CCOptions)->setRequired(true)->addValidator('NotEmpty');
$PhoneNumber = new Zend_Form_Element_Text('phone_number');
$PhoneNumber->setName('phone_number')->setLabel('Phone Number(R/O)')->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => true)))->addFilters(array('StripTags', 'StringTrim'))->setRequired(false);
$Email = new Zend_Form_Element_Text('email');
$Email->setName('email')->setLabel('Email Id:')->addValidator('NotEmpty')->addValidator('EmailAddress')->addFilters(array('StripTags', 'StringTrim'));
$CounseleeStatus = new Application_Model_DbTable_MstCounseleeStatus();
$CounseleeStatusOptions = $CounseleeStatus->getCounseleeStatus();
$CounsellingStatus = new Zend_Form_Element_Select('counselee_status');
$CounsellingStatus->setName('counselee_status')->setLabel('Counselling Status*')->setRequired(true)->setMultiOptions($CounseleeStatusOptions);
$ActiveStatus = new Zend_Form_Element_Select('active_status');
$ActiveStatus->setName('active_status')->setLabel('Active Status*')->setMultiOptions(array('A' => 'Active', 'I' => 'Inactive', 'E' => 'Deceased'))->setRequired(true);
$SubForm_BasicInfo->addElements(array($DevPic, $Fname, $Mname, $Lname, $Day, $Month, $Year, $Gender, $CountryCode, $Mobile, $PhoneNumber, $Email, $Center, $Counselor, $Mentor, $CounsellingStatus, $ActiveStatus));
/*Personal Information */
$SubForm_Personal_Info = new Zend_Form_SubForm();
$langsknownOptions = new Application_Model_DbTable_MstLanguage();
$langsknownOptions = $langsknownOptions->getLanguagelist();
$MotherTongue = new Zend_Form_Element_select('mother_tongue');
$MotherTongue->setName('mother_tongue')->setLabel('Mother Tongue*')->setMultiOptions($langsknownOptions)->addFilters(array('StripTags', 'StringTrim'))->setRequired(true);
$LanguagesKnown = new Zend_Form_Element_MultiSelect('languages_known');
$LanguagesKnown->setName('languages_known')->setLabel('Languages Known* ')->setMultiOptions($langsknownOptions)->setRequired(true);
$BldGrp = new Zend_Form_Element_Select('bld_grp');
$BldGrp->setName('bld_grp')->setLabel('Blood Group')->setMultiOptions(Rgm_Basics::getBloodGroupsAsoArr());
$Religion = new Application_Model_DbTable_MstReligion();
$ReligionOptions = $Religion->getReligionslist();
$PrevReligion = new Zend_Form_Element_Select('previous_religion');
$PrevReligion->setName('previous_religion')->setLabel('Previous Religion*')->setMultiOptions($ReligionOptions)->setRequired(true);
$SubForm_Personal_Info->addElements(array($MotherTongue, $BldGrp, $PrevReligion, $LanguagesKnown));
//PRESENT AND PERMENANT ADDRESS INFORMATION
$SubForm_Address_Info = new Zend_Form_SubForm();
$NativePlace = new Zend_Form_Element_Text('native_place');
$NativePlace->setName('native_place')->setLabel('Native Place* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$NativeStatedb = new Application_Model_DbTable_MstState();
$NativeStateOptions = $NativeStatedb->getStateKeyValues();
$NativeState = new Zend_Form_Element_Select('native_state');
$NativeState->setName('native_state')->SetLabel('Native State* ')->setMultiOptions($NativeStateOptions)->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentAddLine1 = new Zend_Form_Element_Text('present_addline1');
$PresentAddLine1->setName('addline1')->setLabel('PlotNo.\\Room No.\\Wing*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentAddLine2 = new Zend_Form_Element_Text('present_addline2');
$PresentAddLine2->setName('addline2')->setLabel('Bulding\\Chawl')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentLocality = new Zend_Form_Element_Text('present_locality');
$PresentLocality->setName('present_locality')->setLabel('Locality*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentCity = new Zend_Form_Element_Text('present_city');
$PresentCity->setName('present_city')->SetLabel('City')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentState = new Zend_Form_Element_Text('present_state');
$PresentState->setName('present_state')->setLabel('State* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentCountry = new Zend_Form_Element_Text('present_country');
$PresentCountry->setName('present_country')->SetLabel('Country* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PresentZipCode = new Zend_Form_Element_Text('present_zip_code');
$PresentZipCode->setName('present_zip_code')->setLabel('Zip Code* ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PermenantAddLine1 = new Zend_Form_Element_Text('permenant_addline1');
$PermenantAddLine1->setName('permenant_addline1')->setLabel('PlotNo.\\Room No.\\Wing*')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
$PermenantAddLine2 = new Zend_Form_Element_Text('permenant_addline2');
//.........这里部分代码省略.........
示例2: zendConformElementName
/**
* @return true if string can be used as zend_form_element name, else Exception
*
*/
private function zendConformElementName($string)
{
$element = new Zend_Form_Element_Text($string);
$element->setName($string);
if ($element->getName() !== $string) {
throw new Publish_Model_FormIncorrectFieldNameException($string);
}
return true;
}