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


PHP Zend_Form_Element_Hidden::setRequired方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/programme');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $best = new Zend_Form_Element_Textarea('best_stuff');
     $best->setLabel('Which sessions or presentations were the best – and why?')->setAttrib('class', 'medium')->setDescription('Please limit your comments to 1000 characters')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer comment', Zend_Validate_StringLength::TOO_LONG => 'Your comment is too long')))->setDecorators(array('Composite'));
     $worst = clone $best;
     $worst->setName('worst_stuff')->setLabel('Which sessions or presentations were the worst – and why?');
     $comments = clone $best;
     $comments->setName('comments')->setLabel('Comments on the programme');
     $this->addElements(array($id, $best, $worst));
     $elements = array('exhibition' => 'How useful did you find the exhibitions and demos?', 'meetings' => 'How useful did you find the meetings / workshops around the conference?', 'lightning' => 'How useful did you find the lightning talks?', 'poster' => 'How useful did you find the poster presentations?');
     // add all elements in loop, since they are all the same
     foreach ($elements as $name => $label) {
         $newSelect = new Zend_Form_Element_Radio($name);
         $newSelect->setLabel($label)->setAttrib('class', 'tiny')->setMultiOptions($this->_getFieldValues('rating', 'feedback'))->setDecorators(array('Composite'));
         $newText = new Zend_Form_Element_Text('remarks_' . $name);
         $newText->setDescription('Comments')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
         $this->addElements(array($newSelect, $newText));
     }
     $this->addElement($comments);
     $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator));
 }
开发者ID:GEANT,项目名称:CORE,代码行数:25,代码来源:Programme.php

示例2: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/participant');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $country = new TA_Form_Element_Country('country');
     $country->setLabel('Please select the country in which you work as primary place of employment.')->setDecorators(array('Composite'));
     $orgType = new Zend_Form_Element_Select('org_type');
     $orgType->setLabel('Please select the type of organisation that most closely resembles your primary place of employment.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'nren' => 'National Research and Education Network (NREN)', 'high' => 'Higher / Further Education Institute (universities / college / polytechnic...)', 'ari' => 'Academic Research Institute', 'project' => 'Research project', 'admin' => 'Administrative departments of academic institutions', 'local' => 'Local / regional / central government department', 'cultural' => 'Cultural organisation (galeries, librairies, museums, etc.)', 'comm' => 'Commercial organisation', 'other' => 'Other non-profit (specify)'))->setDecorators(array('Composite'));
     $orgOther = new Zend_Form_Element_Text('org_type_other');
     $orgOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $occupation = new Zend_Form_Element_Select('occupation');
     $occupation->setLabel('Please select the title that most closely resembles your primary role in the organisation.')->setAttrib('class', 'medium')->setMultiOptions(array('0' => '---', 'director' => 'Director (responsible for overall organisational management)', 'manager' => 'Technical Manager', 'admin' => 'Administrative / Operational Manager', 'tech' => 'Technical staff / Engineer', 'res' => 'Researcher / Scientist', 'prof' => 'Professor / Teacher', 'pr' => 'Public Relations / Communications', 'bizz' => 'Business Development', 'stud' => 'Student', 'other' => 'Other (specify)'))->setDecorators(array('Composite'));
     $occOther = new Zend_Form_Element_Text('occupation_other');
     $occOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $interest = new Zend_Form_Element_MultiCheckbox('interest');
     $interest->setLabel('Please select your main areas of interest. Up to three selections are possible.')->setAttrib('class', 'tiny')->setMultiOptions(array('sec' => 'Network security (incident, prevention and response)', 'nom' => 'Network operations management', 'clouds' => 'Storage and clouds', 'grids' => 'Grids', 'media' => 'Media management and distribution', 'auth' => 'Authentication and Authorisation systems and federations', 'wireless' => 'Fixed & mobile wireless and roaming technologies', 'vid' => 'Video / web-based conferencing', 'reg' => 'Regulatory issues including privacy', 'pr' => 'PR / communications / business development', 'strat' => 'Strategic development: European policy setting and / or organisational management', 'other' => 'Other (specify)'))->addValidator('Callback', true, array('callback' => function ($value, $arr) {
         return count($arr['interest']) > 3 ? false : true;
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Please don't select more than three options")))->setDecorators(array('Composite'));
     $intOther = new Zend_Form_Element_Text('interest_other');
     $intOther->setDescription('Other, please specify')->setAttrib('class', 'medium')->setDecorators(array('Composite'));
     $this->addElements(array($id, $country, $orgType, $orgOther, $occupation, $occOther, $interest, $intOther));
     $this->addElement('submit', 'submit', array('decorators' => $this->_buttonElementDecorator));
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:25,代码来源:Participant.php

示例3: _initVOId

 /**
  * @return EngineBlock_Form_VirtualOrganisationIdp
  */
 public function _initVOId()
 {
     $element = new Zend_Form_Element_Hidden('vo_id');
     $element->setRequired(TRUE);
     $element->setAllowEmpty(false);
     return $this->addElement($element);
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-manage,代码行数:10,代码来源:VirtualOrganisationIdp.php

示例4: _initGroupProviderId

 /**
  * @return EngineBlock_Form_GroupProviderGroupMemberFilter
  */
 public function _initGroupProviderId()
 {
     $element = new Zend_Form_Element_Hidden('group_provider_id');
     $element->setRequired(TRUE);
     $element->setAllowEmpty(false);
     return $this->addElement($element);
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-manage,代码行数:10,代码来源:GroupProviderGroupMemberFilter.php

示例5: __construct

    public function __construct($options = null)
    {
        parent::__construct($options);
        $this->setName('addreference');
        $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
        $title = new Zend_Form_Element_Text('publicationtitle');
        $title->setLabel('Publication title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a title')->setAttrib('size', 60)->setDescription('As the bibliographic details that have been entered are such a mess, 
		this is slightly tricky. Try one word from the title of the book/journal or an author surname. 
		Then click on the one that comes up.')->setDecorators($decorators);
        $id = new Zend_Form_Element_Hidden('pubID');
        $id->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label');
        $pages = new Zend_Form_Element_Text('pages_plates');
        $pages->setLabel('Pages or plate number: ')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 9);
        $reference = new Zend_Form_Element_Text('reference');
        $reference->setLabel('Reference number: ')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->setAttrib('size', 15);
        //Submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large');
        $this->addElements(array($title, $id, $pages, $reference, $submit));
        $hash = new Zend_Form_Element_Hash('csrf');
        $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
        $this->addElement($hash);
        $this->addDisplayGroup(array('publicationtitle', 'pubID', 'pages_plates', 'reference'), 'details')->removeDecorator('HtmlTag');
        $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
        $this->details->removeDecorator('DtDdWrapper');
        $this->details->removeDecorator('HtmlTag');
        $this->details->setLegend('Add a new reference');
        $this->addDisplayGroup(array('submit'), 'submit');
    }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:29,代码来源:ReferenceFindForm.php

示例6: init

 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
     // Producto
     $e = new Zend_Form_Element_Select('id_producto');
     $e->setLabel('Producto');
     $e->setRequired();
     $_producto = new Application_Model_Producto();
     $e->addMultiOption(-1, '--Producto--');
     $e->addMultiOptions($_producto->getComboValues());
     $e->addValidator(new Zend_Validate_InArray($_producto->getComboValidValues()));
     $this->addElement($e);
     // Cantidad
     $e = new Zend_Form_Element_Text('cantidad');
     $e->setLabel('Cantidad');
     $e->setRequired();
     $e->addValidator(new Zend_Validate_Int(new Zend_Locale('US')));
     $e->addValidator(new Zend_Validate_GreaterThan(0));
     $e->addValidator(new Zend_Validate_LessThan(100));
     $this->addElement($e);
     // AddVentaDetalles
     $e = new Zend_Form_Element_Hidden('is_detalle');
     $e->setValue(true);
     $e->setRequired();
     $this->addElement($e);
     //Submit
     $e = new Zend_Form_Element_Submit('submit');
     $e->setLabel('Agregar');
     $this->addElement($e);
 }
开发者ID:helmutpacheco,项目名称:ventas,代码行数:30,代码来源:VentaDetalle.php

示例7: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/review/edit');
     $reviewId = new Zend_Form_Element_Hidden('review_id');
     $reviewId->setRequired(true)->setLabel('review_id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $this->addElement($reviewId);
 }
开发者ID:GEANT,项目名称:CORE,代码行数:8,代码来源:Edit.php

示例8: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/session/chairs');
     $submissionId = new Zend_Form_Element_Hidden('session_id');
     $submissionId->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     $users = new TA_Form_Element_User('user_id');
     $users->setTaController('session')->populateElement('chair')->setAttrib('onchange', "this.form.submit()");
     $this->addElements(array($submissionId, $users));
 }
开发者ID:br00k,项目名称:tnc-web,代码行数:10,代码来源:User.php

示例9: init

 public function init($userId)
 {
     global $mySession;
     $db = new Db();
     $full_name_value = "";
     $location_value = "";
     $check_in_value = "";
     $rating_value = "";
     $headline_value = "";
     $comment_value = "";
     $review_value = "";
     /*if($userId != "")
     		{
     			$userData = $db->runQuery("select * from ".OWNER_REVIEW." where property_id = '".$userId."' ");	
     			
     			if($userData != "" && count($userData) > 0)
     			{
     				$full_name_value = $userData[0]['owner_name'];
     				$location_value = $userData[0]['location'];
     				$check_in_value = $userData[0]['check_in'];
     				$rating_value = $userData[0]['rating'];
     				$headline_value = $userData[0]['headline'];
     				$comment_value = $userData[0]['comment'];
     				$review_value = $userData[0]['review'];
     			}
     			
     		}*/
     $full_name = new Zend_Form_Element_Text('full_name');
     $full_name->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter Full Name"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($full_name_value);
     $location = new Zend_Form_Element_Text('location');
     $location->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "50")->setValue($location_value);
     $check_in = new Zend_Form_Element_Text('check_in');
     $check_in->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "Please enter phone number"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($check_in_value);
     $ratingArr = array();
     $ratingArr[0]['key'] = "";
     $ratingArr[0]['value'] = "- - Select - -";
     for ($i = 1; $i <= 10; $i++) {
         $ratingArr[$i]['key'] = $i;
         $ratingArr[$i]['value'] = $i;
     }
     $rating = new Zend_Form_Element_Select('rating');
     $rating->setRequired(true)->addMultiOptions($ratingArr)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required")->setValue($rating_value);
     $headline = new Zend_Form_Element_Text('headline');
     $headline->setRequired(true)->addValidator('NotEmpty', true, array('messages' => "enter email address"))->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "mws-textinput required reviewHeadline")->setAttrib("maxlength", "100")->setValue($headline_value);
     $comment = new Zend_Form_Element_Textarea('comment');
     $comment->addDecorator('Errors', array('class' => 'error'))->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "300")->setValue($comment_value);
     $review = new Zend_Form_Element_Textarea('review');
     $review->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib("class", "required")->setAttrib("rows", "4")->setAttrib("cols", "30")->setAttrib("maxlength", "1000")->addValidator('NotEmpty', true, array('messages' => "Enter message"))->setValue($review_value);
     $step = new Zend_Form_Element_Hidden('step');
     $step->setRequired(true)->setValue("8");
     /*$check = new Zend_Form_Element_Hidden('check');
     		$check->setRequired(true)
     		->setValue($text);*/
     $this->addElements(array($full_name, $location, $check_in, $rating, $headline, $comment, $review, $step));
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:55,代码来源:Oreview.php

示例10: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setMethod('GET');
     self::$_instanceCounter++;
     $idEl = new Zend_Form_Element_Hidden(self::$_idParam);
     $idEl->setRequired(false);
     $idEl->setValue($this->_getFormid());
     $this->setAttrib('id', $this->_getFormid());
     $this->addElement($idEl);
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:11,代码来源:Multiform.php

示例11: init

 public function init($name = "")
 {
     global $mySession;
     $db = new Db();
     //echo "url ....  : ".$name; die;
     $emailid_val = "";
     $emailfrnz_val = "";
     $quremailid = $db->runquery("SELECT emailid FROM  " . ORDER_RECORD . " WHERE teeurl='" . $name . "'");
     //prd($quremailid);
     if ($quremailid != "" and count($quremailid) > 0) {
         for ($i = 0; $i < count($quremailid); $i++) {
             if ($i == 0) {
                 $emailfrnz[$i] = $quremailid[$i]['emailid'];
             } else {
                 if (!in_array($quremailid[$i]['emailid'], $emailfrnz)) {
                     $emailfrnz[$i] = $quremailid[$i]['emailid'];
                 }
             }
         }
         //		prd($emailfrnz);
         $emailfrnz_val = implode(",", $emailfrnz);
     }
     $qur1 = $db->runquery("SELECT * FROM  " . LAUNCHCAMPAIGN . " WHERE url='" . $name . "' ");
     $qur = $db->runquery("SELECT * FROM  " . USERS . " WHERE user_id='" . $qur1[0]['user_id'] . "'");
     //$qur=$db->runquery("select * from ".ADDRESS." join ".STATE." on ".STATE.".state_id=".ADDRESS.".state where user_id='".$mySession->TeeLoggedID."' ");
     if ($qur != "" and count($qur) > 0) {
         $emailid_val = $qur[0]['emailid'];
     }
     # FORM ELEMENT:public name
     # TYPE : text
     $emailid = new Zend_Form_Element_Text('emailid');
     $emailid->setRequired(true)->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:30px;")->setValue($emailid_val);
     if (@$_REQUEST['emailid'] != "") {
         $emailid->addValidator('EmailAddress', true)->addDecorator('Errors', array('class' => 'error'))->addErrorMessage('Please enter a valid email address');
     }
     # FORM ELEMENT:address
     # TYPE : text
     //$friendsemailid= new Zend_Form_Element_Text('friendsemailid');
     //		$friendsemailid->setRequired(true)
     //		->addValidator('NotEmpty',true,array('messages' =>'One id is required'))
     //		->addDecorator('Errors', array('class'=>'errmsg'))
     //		->setAttrib("style","width:300px; height:30px;")
     //		->setAttrib('class','changepasstextbox')
     //		->setValue($emailfrnz_val);
     $friendsemailid = new Zend_Form_Element_Hidden('friendsemailid');
     $friendsemailid->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'One id is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib("style", "width:300px; height:30px;")->setAttrib('class', 'changepasstextbox')->setValue($emailfrnz_val);
     # FORM ELEMENT:city
     # TYPE : text
     $subject = new Zend_Form_Element_Text('subject');
     $subject->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Subject is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:30px;");
     $content = new Zend_Form_Element_Textarea('content');
     $content->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Content is required'))->addDecorator('Errors', array('class' => 'error'))->setAttrib('class', 'changeaddress')->setAttrib("style", "width:300px; height:150px;");
     $this->addElements(array($emailid, $friendsemailid, $subject, $content));
 }
开发者ID:Alexeykolobov,项目名称:php,代码行数:54,代码来源:Emailfriends.php

示例12: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/user/roles');
     $id = new Zend_Form_Element_Hidden('user_id');
     $id->setRequired(true)->addValidators(array('Int'))->setDecorators(array('Composite'));
     $userModel = new Core_Model_User();
     $roles = new Zend_Form_Element_Select('role_id');
     $roles->setAttrib('class', 'large')->setAttrib('onchange', 'this.form.submit()')->setMultiOptions($userModel->getRolesForSelect())->setDecorators(array('Composite'));
     $this->addElements(array($id, $roles));
 }
开发者ID:GEANT,项目名称:CORE,代码行数:11,代码来源:Role.php

示例13: init

    public function init()
    {
        $this->setMethod('post');
        $this->setAttrib('enctype', 'multipart/form-data');

        $photo = new Zend_Form_Element_File('photo');
        $photo->setLabel('photo.upload');
        $photo->setDestination($this->getAttrib('tmp'));

        $photo->addValidator('Count', false, 1);
        $photo->addValidator('Size', false, $this->getAttrib('filesize'));
        $photo->addValidator(
            'Extension', false, $this->getAttrib('extensions')
        );

        $photo->setRequired(true);
        $photo->removeDecorator('Errors');

        $this->addElement($photo, 'photo');

        $fbId = new Zend_Form_Element_Hidden('fbid');
        $fbId->addValidator(
            'Db_NoRecordExists', false,
            array(
                'table' => 'zdjecia',
                'field' => 'fbuserid'
            )
        );
        $fbId->setLabel('fbid');

        $fbId->setRequired(true);
        $fbId->removeDecorator('Errors');
        $fbId->removeDecorator('Label');

        $this->addElement($fbId);

        $save = new Zend_Form_Element_Submit('Save');
        $save->setLabel('Zgłoś Zdjęcie');
        $save->setAttrib('class', 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only');

        $this->addElement($save);

        $this->addDecorator(
                new Zend_Form_Decorator_FormErrors(
                    array(
                        'ignoreSubForms'=>true,
                        'markupListStart' => '<ul class="ui-state-error ui-corner-all">',
                    )
                )
            )
            ->addDecorator('FormElements')
            ->addDecorator('HtmlTag')
            ->addDecorator('Form');
    }
开发者ID:robsohn,项目名称:portret-jesienny,代码行数:54,代码来源:Zdjecie.php

示例14: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'roles');
     $id = new Zend_Form_Element_Hidden('id');
     $rolename = new Zend_Form_Element_Text('rolename');
     $rolename->setAttrib('maxLength', 50);
     $rolename->setAttrib('title', 'Role name');
     $rolename->addFilter(new Zend_Filter_StringTrim());
     $rolename->setRequired(true);
     $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.'));
     $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.')));
     $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0')));
     $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.');
     $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.')))));
     $roletype = new Zend_Form_Element_Text('roletype');
     $roletype->setRequired(true);
     $roletype->setAttrib('maxLength', 25);
     $roletype->setAttrib('title', 'Role type');
     $roletype->addFilter(new Zend_Filter_StringTrim());
     $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.'));
     $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.')));
     $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0')));
     $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.');
     $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.')))));
     $roledescription = new Zend_Form_Element_Textarea('roledescription');
     $roledescription->setAttrib('rows', 10);
     $roledescription->setAttrib('cols', 50);
     $roledescription->setAttrib('maxlength', '100');
     $roledescription->setAttrib('title', 'Role description');
     $levelid = new Zend_Form_Element_Hidden('levelid');
     $levelid->addFilter(new Zend_Filter_StringTrim());
     $levelid->setRequired(true);
     $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.'));
     $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive');
     $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt');
     $prev_cnt->setRequired(true);
     if ($istimeActive) {
         $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.'));
     } else {
         $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.'));
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $url = "'roles/saveupdate/format/json'";
     $dialogMsg = "''";
     $toggleDivId = "''";
     $jsFunction = "'redirecttocontroller(\\'roles\\');'";
     $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});"));
     $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:samdubey,项目名称:sentrifugo,代码行数:54,代码来源:Roles.php

示例15: init

 public function init()
 {
     parent::init();
     $this->setAction('/core/feedback/mailall');
     $this->setAttrib('id', 'mailform');
     $status = new Zend_Form_Element_Hidden('id');
     $status->setRequired(true)->setLabel('id')->addValidators(array('Int'))->setDecorators(array('Composite'));
     $dummy = new Zend_Form_Element_Checkbox('dummy');
     $dummy->setLabel('Do a test run (does not send emails)')->setChecked(true)->setDecorators(array('Composite'));
     $this->addElements(array($status, $dummy));
     $this->addElement('submit', 'submit', array('label' => 'Send emails (this may take a while)', 'decorators' => $this->_buttonElementDecorator));
 }
开发者ID:GEANT,项目名称:CORE,代码行数:12,代码来源:Mail.php


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