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


PHP Zend_Form_Element_Checkbox::addValidator方法代码示例

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


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

示例1: init

 public function init()
 {
     $elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
     //setting  method and action of the form
     $this->setAction('')->setMethod('post');
     $heartPressure = new Zend_Form_Element_Checkbox('heartpressure', array());
     $heartPressure->setDecorators($elementDecorators);
     $diabetes = new Zend_Form_Element_Checkbox('diabetes', array());
     $diabetes->setDecorators($elementDecorators);
     $migrene = new Zend_Form_Element_Checkbox('migrene', array());
     $migrene->setDecorators($elementDecorators);
     $babies = new Zend_Form_Element_Checkbox('babies', array());
     $babies->setDecorators($elementDecorators);
     $nosleep = new Zend_Form_Element_Checkbox('nosleep', array());
     $nosleep->setDecorators($elementDecorators);
     $digestion = new Zend_Form_Element_Checkbox('digestion', array());
     $digestion->setDecorators($elementDecorators);
     $menopause = new Zend_Form_Element_Checkbox('menopause', array());
     $menopause->setDecorators($elementDecorators);
     $sclorosies = new Zend_Form_Element_Checkbox('sclorosies', array());
     $sclorosies->setDecorators($elementDecorators);
     $epilepsy = new Zend_Form_Element_Checkbox('epilepsy', array());
     $epilepsy->setDecorators($elementDecorators);
     $cancer = new Zend_Form_Element_Checkbox('cancer', array());
     $cancer->setDecorators($elementDecorators);
     $asthma = new Zend_Form_Element_Checkbox('asthma', array());
     $asthma->setDecorators($elementDecorators);
     $artritis = new Zend_Form_Element_Checkbox('artritis', array());
     $artritis->setDecorators($elementDecorators);
     $hernia = new Zend_Form_Element_Checkbox('hernia', array());
     $hernia->setDecorators($elementDecorators);
     $depression = new Zend_Form_Element_Checkbox('depression', array());
     $depression->setDecorators($elementDecorators);
     $headaches = new Zend_Form_Element_Checkbox('headaches', array());
     $headaches->setDecorators($elementDecorators);
     $fatigue = new Zend_Form_Element_Checkbox('fatigue', array());
     $fatigue->setDecorators($elementDecorators);
     $injury = new Zend_Form_Element_Checkbox('injury', array());
     $injury->setDecorators($elementDecorators);
     $injuryText = new Zend_Form_Element_Textarea('injurytext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $medication = new Zend_Form_Element_Checkbox('medication', array());
     $medication->setDecorators($elementDecorators);
     $medicationText = new Zend_Form_Element_Textarea('medicationtext', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $walk = new Zend_Form_Element_Radio('walk', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $walk->setDecorators($elementDecorators);
     $hands = new Zend_Form_Element_Radio('hands', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $hands->setDecorators($elementDecorators);
     $legs = new Zend_Form_Element_Radio('legs', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $legs->setDecorators($elementDecorators);
     $backashes = new Zend_Form_Element_Radio('backashes', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $backashes->setDecorators($elementDecorators);
     $slippedDisk = new Zend_Form_Element_Radio('disc', array('label' => '', 'separator' => '', 'multiOptions' => array('Yes' => 'כן', 'No' => 'לא')));
     $slippedDisk->setDecorators($elementDecorators);
     $generalQuestionsText1 = new Zend_Form_Element_Text('general1', array('id' => 'f_1'));
     $generalQuestionsText2 = new Zend_Form_Element_Text('general2', array('id' => 'f_2'));
     $generalQuestionsText3 = new Zend_Form_Element_Text('general3', array('id' => 'f_3'));
     $generalQuestionsText1->setDecorators($elementDecorators);
     $generalQuestionsText2->setDecorators($elementDecorators);
     $generalQuestionsText3->setDecorators($elementDecorators);
     $lowerback = new Zend_Form_Element_Checkbox('lowerback', array());
     $lowerback->setDecorators($elementDecorators);
     $upperback = new Zend_Form_Element_Checkbox('upperback', array());
     $upperback->setDecorators($elementDecorators);
     $feet = new Zend_Form_Element_Checkbox('feet', array());
     $feet->setDecorators($elementDecorators);
     $neck = new Zend_Form_Element_Checkbox('neck', array());
     $neck->setDecorators($elementDecorators);
     $breath = new Zend_Form_Element_Checkbox('breath', array());
     $breath->setDecorators($elementDecorators);
     $pelvis = new Zend_Form_Element_Checkbox('pelvis', array());
     $pelvis->setDecorators($elementDecorators);
     $knees = new Zend_Form_Element_Checkbox('knees', array());
     $knees->setDecorators($elementDecorators);
     $wrists = new Zend_Form_Element_Checkbox('wrists', array());
     $wrists->setDecorators($elementDecorators);
     $head = new Zend_Form_Element_Checkbox('head', array());
     $head->setDecorators($elementDecorators);
     $ankles = new Zend_Form_Element_Checkbox('ankles', array());
     $ankles->setDecorators($elementDecorators);
     $externalMails = new Zend_Form_Element_Checkbox('external', array());
     $externalMails->setDecorators($elementDecorators);
     $moreInfo = new Zend_Form_Element_Textarea('moreinfo', array('id' => 'obj', 'rows' => '20', 'cols' => '20'));
     $terms = new Zend_Form_Element_Checkbox('terms', array('label' => '', 'multiOptions' => array('Yes' => 'Yes')));
     $terms->setDecorators($this->elementCheckboxes);
     $terms->addDecorator('Label', array('escape' => false));
     $terms->addValidator(new User_Form_UserTermsConditionsValidator());
     $this->addElements(array($heartPressure, $diabetes, $migrene, $babies, $nosleep, $digestion, $menopause, $sclorosies, $epilepsy, $cancer, $asthma, $artritis, $hernia, $depression, $fatigue, $headaches, $injury, $injuryText, $medication, $medicationText, $walk, $hands, $legs, $backashes, $slippedDisk, $generalQuestionsText1, $generalQuestionsText2, $generalQuestionsText3, $lowerback, $upperback, $feet, $neck, $breath, $pelvis, $knees, $wrists, $head, $ankles, $moreInfo, $externalMails, $terms));
 }
开发者ID:Navigator1278,项目名称:Tipulitonline,代码行数:88,代码来源:UserSecondForm.php

示例2: __construct

    public function __construct($options = null)
    {
        $this->_disabledDefaultActions = true;
        parent::__construct($options);
        $baseDir = $this->getView()->baseUrl();
        if (!empty($options['mode']) && $options['mode'] == 'edit') {
            $this->_mode = 'edit';
        } else {
            $this->_mode = 'add';
        }
        $langId = Zend_Registry::get('languageID');
        $this->setAttrib('id', 'accountManagement');
        //            $addressParams = array(
        //                "fieldsValue" => array(),
        //                "display"   => array(),
        //                "required" => array(),
        //            );
        // Salutation
        $salutation = new Zend_Form_Element_Select('salutation');
        $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallSelect')->setAttrib('tabindex', '1')->setOrder(1);
        $greetings = $this->getView()->getAllSalutation();
        foreach ($greetings as $greeting) {
            $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
        }
        // Language
        $languages = new Zend_Form_Element_Select('language');
        $languages->setLabel($this->getView()->getCibleText('form_label_language'))->setAttrib('class', 'stdSelect')->setAttrib('tabindex', '9')->setOrder(9);
        foreach (Cible_FunctionsGeneral::getAllLanguage() as $lang) {
            $languages->addMultiOption($lang['L_ID'], $lang['L_Title']);
        }
        // FirstName
        $firstname = new Zend_Form_Element_Text('firstName');
        $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '2')->setOrder(2);
        // LastName
        $lastname = new Zend_Form_Element_Text('lastName');
        $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '3')->setOrder(3);
        // email
        $regexValidate = new Cible_Validate_Email();
        $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
        $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email');
        $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound');
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setAttrib('tabindex', '5')->setOrder(5);
        if ($this->_mode == 'add') {
            $email->addValidator($emailNotFoundInDBValidator);
        }
        // email
        // password
        $password = new Zend_Form_Element_Password('password');
        if ($this->_mode == 'add') {
            $password->setLabel($this->getView()->getCibleText('form_label_password'));
        } else {
            $password->setLabel($this->getView()->getCibleText('form_label_newPwd'));
        }
        $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '6')->setRequired(true)->setOrder(6)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
        // password
        // password confirmation
        $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation');
        if ($this->_mode == 'add') {
            $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
        } else {
            $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
        }
        //                $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'));
        $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(7)->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '7')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical'))));
        if (!empty($_POST['identification']['password'])) {
            $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
            $Identical = new Zend_Validate_Identical($_POST['identification']['password']);
            $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
            $passwordConfirmation->addValidator($Identical);
        }
        // password confirmation
        // Company name
        $company = new Zend_Form_Element_Text('company');
        $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setAttrib('tabindex', '4')->setOrder(4)->setAttribs(array('class' => 'stdTextInput'));
        // Account number
        $account = new Zend_Form_Element_Text('accountNum');
        $account->setLabel($this->getView()->getCibleText('form_label_account'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setOrder(8)->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '8')->setDecorators(array('ViewHelper', 'Errors', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical'))));
        // Text Subscribe
        $textSubscribe = $this->getView()->getCibleText('form_label_subscribe');
        $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->privacyPolicy->pageId), $textSubscribe);
        // Newsletter subscription
        $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription');
        $newsletterSubscription->setLabel($textSubscribe);
        if ($this->_mode == 'add') {
            $newsletterSubscription->setChecked(1);
        }
        $newsletterSubscription->setAttrib('class', 'long-text');
        $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'subscribeNewsletter', 'class' => 'label_after_checkbox'))));
        if ($this->_mode == 'add') {
            $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement');
            $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement')));
            $termsAgreement->setAttrib('class', 'long-text');
            $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
            $termsAgreement->setRequired(true);
            $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms')));
        } else {
            $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1));
        }
        // Submit button
//.........这里部分代码省略.........
开发者ID:anunay,项目名称:stentors,代码行数:101,代码来源:FormBecomeClient.php

示例3: __construct

 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     parent::__construct($options);
     $baseDir = $this->getView()->baseUrl();
     if (!empty($options['mode']) && $options['mode'] == 'edit') {
         $this->_mode = 'edit';
     } else {
         $this->_mode = 'add';
     }
     $langId = Zend_Registry::get('languageID');
     $this->setAttrib('id', 'accountManagement');
     $this->setAttrib('class', 'step3');
     //            $addressParams = array(
     //                "fieldsValue" => array(),
     //                "display"   => array(),
     //                "required" => array(),
     //            );
     //Hidden fields for the state and cities id
     $selectedState = new Zend_Form_Element_Hidden('selectedState');
     $selectedState->removeDecorator('label');
     $selectedCity = new Zend_Form_Element_Hidden('selectedCity');
     $selectedCity->removeDecorator('label');
     $this->addElement($selectedState);
     $this->addElement($selectedCity);
     // Salutation
     $salutation = new Zend_Form_Element_Select('salutation');
     $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallTextInput')->setOrder(1);
     $greetings = $this->getView()->getAllSalutation();
     foreach ($greetings as $greeting) {
         $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
     }
     // language hidden field
     $language = new Zend_Form_Element_Hidden('language', array('value' => $langId));
     $language->removeDecorator('label');
     // langauge hidden field
     // FirstName
     $firstname = new Zend_Form_Element_Text('firstName');
     $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(2);
     // LastName
     $lastname = new Zend_Form_Element_Text('lastName');
     $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(3);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email');
     $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setOrder(4);
     if ($this->_mode == 'add') {
         $email->addValidator($emailNotFoundInDBValidator);
     }
     // email
     // password
     $password = new Zend_Form_Element_Password('password');
     if ($this->_mode == 'add') {
         $password->setLabel($this->getView()->getCibleText('form_label_password'));
     } else {
         $password->setLabel($this->getView()->getCibleText('form_label_newPwd'));
     }
     $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setRequired(true)->setOrder(5)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     // password
     // password confirmation
     $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation');
     if ($this->_mode == 'add') {
         $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd'));
     } else {
         $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'));
     }
     $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(6)->setAttrib('class', 'stdTextInput');
     if (!empty($_POST['identification']['password'])) {
         $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
         $Identical = new Zend_Validate_Identical($_POST['identification']['password']);
         $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
         $passwordConfirmation->addValidator($Identical);
     }
     // password confirmation
     // Company name
     $company = new Zend_Form_Element_Text('company');
     $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setOrder(7)->setAttribs(array('class' => 'stdTextInput'));
     // function in company
     $functionCompany = new Zend_Form_Element_Text('functionCompany');
     $functionCompany->setLabel($this->getView()->getCibleText('form_label_account_function_company'))->setRequired(false)->setOrder(8)->setAttribs(array('class' => 'stdTextInput'));
     // Are you a retailer
     $retailer = new Zend_Form_Element_Select('isRetailer');
     $retailer->setLabel($this->getView()->getClientText('form_label_retailer'))->setAttrib('class', 'smallTextInput');
     $retailer->addMultiOption(0, $this->getView()->getCibleText('button_no'));
     $retailer->addMultiOption(1, $this->getView()->getCibleText('button_yes'));
     // Text Subscribe
     $textSubscribe = $this->getView()->getCibleText('form_label_subscribe');
     $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->page_privacy_policy->pageID), $textSubscribe);
     // Newsletter subscription
     $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription');
     $newsletterSubscription->setLabel($textSubscribe);
     if ($this->_mode == 'add') {
         $newsletterSubscription->setChecked(1);
     }
     $newsletterSubscription->setAttrib('class', 'long-text');
     $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     if ($this->_mode == 'add') {
//.........这里部分代码省略.........
开发者ID:anunay,项目名称:stentors,代码行数:101,代码来源:FormOrder.php

示例4: init

 public function init()
 {
     //setting  method and action of the form
     $this->setAction('/user/registration/first-form/')->setAttrib('enctype', 'multipart/form-data')->setDecorators($this->formDecorators)->setMethod('post');
     //firstname field
     $firstName = new Zend_Form_Element_Text('firstname', array('required' => true, 'label' => 'שם פרטי:', 'maxLength' => '30', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     $firstName->setDecorators($this->elementDecorators);
     //last- or familyname field
     $familyName = new Zend_Form_Element_Text('familyname', array('required' => true, 'label' => 'שם משפחה:', 'validators' => array(array('stringLength', false, array(3, 100)), array('Alpha'))));
     $familyName->setDecorators($this->elementDecorators);
     // status field goes here
     /*
      * TODO
      */
     //selecting gender: Male (1) or Female (0)
     $gender = new Zend_Form_Element_Radio('sex', array('required' => true, 'label' => 'מין:', 'separator' => '', 'multiOptions' => array('1' => 'זכר ', '0' => 'נקבה')));
     $gender->setDecorators($this->elementDecorators);
     //birthday field: validation for yyyy-mm-dd input
     $birthday = new Zend_Form_Element_Text('datepicker', array('required' => true, 'label' => 'שנת לידה:', 'size' => 10));
     $birthday->setDecorators($this->elementDecorators);
     $birthday->addValidator(new Zend_Validate_Date());
     $weight = new Zend_Form_Element_Select('weight', array('label' => 'שקל'));
     for ($i = 20; $i <= 300; $i++) {
         $weight->addMultiOption($i, $i);
     }
     $weight->setDecorators($this->elementDecorators);
     $heigth = new Zend_Form_Element_Select('heigth', array('label' => 'גובה:'));
     for ($i = 120; $i <= 300; $i++) {
         $heigth->addMultiOption($i, $i);
     }
     $heigth->setDecorators($this->elementDecorators);
     //email field with validation
     $email = new Zend_Form_Element_Text('email', array('required' => true, 'size' => 50, 'label' => 'אימייל: '));
     $email->addValidator(new Zend_Validate_EmailAddress());
     $email->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'users', 'field' => 'u_email')));
     $email->setDecorators($this->elementDecorators);
     // password field
     $password1 = new Zend_Form_Element_Password('password1', array('required' => true, 'size' => 50, 'label' => 'סיסמא'));
     $password1->setDecorators($this->elementDecorators);
     // password confirmation field
     $password2 = new Zend_Form_Element_Password('password2', array('required' => true, 'size' => 50, 'label' => 'אימות סיסמא'));
     $password2->addValidator(new User_Form_UserFirstFormPasswordValidator('password1'));
     $password2->setDecorators($this->elementDecorators);
     $country_list = $this->getCountriesList();
     $state = new Zend_Form_Element_Select('state', array('requred' => true, 'label' => 'מדינה:'));
     $state->setMultiOptions(array($country_list));
     $state->setDecorators($this->elementDecorators);
     $address = new Zend_Form_Element_Text('address', array('required' => false, 'size' => 50, 'label' => 'כתובת מלאה:'));
     $address->setDecorators($this->elementDecorators);
     //selecting gender: Male (1) or Female (0)
     $pregnant = new Zend_Form_Element_Radio('pregnant', array('label' => 'לנשים: האם את בהריון?', 'separator' => '', 'multiOptions' => array('Yes' => 'Yes', 'No' => 'No')));
     $pregnant->setDecorators($this->elementDecorators);
     $pregnantSince = new Zend_Form_Element_Select('pregnantsince', array('label' => 'מספר חודשים שעברו מהלידה האחרונה:'));
     $pregnantSince->setMultiOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9'));
     $pregnantSince->setDecorators($this->elementDecorators);
     $objectives = new Zend_Form_Element_Textarea('objectives', array('label' => 'מהן המטרות שלך בתרגול איתנו?'));
     $terms = new Zend_Form_Element_Checkbox('terms', array('label' => "<a target='new' href='http://lc.tipulitonline.co.il/pages/takanon.html'>אישור הסכמה לתנאים וההגבלות</a>", 'required' => 'true,'));
     $terms->setDecorators($this->elementDecorators);
     $terms->addDecorator('Label', array('escape' => false));
     $terms->addValidator(new User_Form_UserTermsConditionsValidator());
     //submit the form
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('שלח ');
     $this->addElements(array($firstName, $familyName, $gender, $weight, $heigth, $birthday, $email, $password1, $password2, $state, $address, $pregnant, $pregnantSince, $objectives, $terms, $submit));
 }
开发者ID:Navigator1278,项目名称:Tipulitonline,代码行数:65,代码来源:UserFirstForm.php


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