本文整理汇总了PHP中Zend_Form_Element_Radio::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Radio::setValue方法的具体用法?PHP Zend_Form_Element_Radio::setValue怎么用?PHP Zend_Form_Element_Radio::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Radio
的用法示例。
在下文中一共展示了Zend_Form_Element_Radio::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startFrom
public function startFrom()
{
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
$output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
if ($setting['output_sound_device'] != "true") {
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$icecast_vorbis_metadata->setAttrib("readonly", true);
}
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name"));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$radioKind = new Zend_Form_Element_Radio('kind');
$radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
$radioKind->setValue('and');
$radioKind->setLabel('Search field combination:');
$radioKind->setRequired(true);
$this->addElement($radioKind);
$fishSampleCode = new Zend_Form_Element_Text(Fish::COL_SAMPLE_CODE);
$fishSampleCode->setLabel('Fish Sample Code:');
//---------------------------------------------------------
//read the available image attributes from attribute descriptor+group image
$metadata = new Default_MetaData();
$fishRowSetArray = $metadata->getAttributesComplete('fish');
//----------------------------------------------------------
$this->addDynamicElements($fishRowSetArray, true);
$this->addElement($fishSampleCode);
$this->addElement('submit', 'submit', array('label' => 'search'));
$this->addElement('hidden', 'Token');
$this->setElementFilters(array('StringTrim'));
//#####################new###################################
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'dynamic_form')), array('Description', array('placement' => 'prepend')), 'Form'));
$this->setElementDecorators(array('ViewHelper', 'Errors', array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
$this->setSubFormDecorators(array('FormElements', array('HtmlTag', array('tag' => 'tr'))));
foreach ($this->getSubForms() as $index => $subform) {
$subform->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
}
$this->submit->setDecorators(array(array('decorator' => 'ViewHelper', 'options' => array('helper' => 'formSubmit')), array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td', 'colspan' => 2)), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))));
//###########################################################
}
示例3: init
public function init()
{
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true;
$this->isSaas = $isSaas;
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))));
$defaultFade = Application_Model_Preference::GetDefaultFade();
if ($defaultFade == "") {
$defaultFade = '0.500000';
}
//Station name
$this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
//Default station fade
$this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade (s):', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-9]{1,2}(\\.\\d{1,6})?$/', 'messages' => 'enter a time in seconds 0{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper')));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
$third_party_api->setMultiOptions(array("Disabled", "Enabled"));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
/* Form Element for setting the Timezone */
$timezone = new Zend_Form_Element_Select("timezone");
$timezone->setLabel("Timezone");
$timezone->setMultiOptions($this->getTimezones());
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
/* Form Element for setting which day is the start of the week */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
$week_start_day->setLabel("Week Starts On");
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
}
示例4: init
public function init()
{
$this->setMethod('POST');
$this->setName("adminForm");
$element = new Zend_Form_Element_Hidden('id');
$element->setValue($this->advertisement->id);
$this->addElement($element);
$element = new Zend_Form_Element_Hidden('city');
$element->setValue($this->city);
$this->addElement($element);
$element = new Zend_Form_Element_Radio('action');
$element->setMultiOptions(array('0' => '已解决, 关闭帖子', '1' => '打错了些东东, 修改帖子', '2' => '我是管理员, 删除帖子'));
$element->setValue(0);
$this->addElement($element);
$element = new Zend_Form_Element_Text('password');
$element->setLabel('密码');
$element->setDescription('忘记密码?');
$this->addElement($element);
$element = new Elements();
$element->addReCaptcha($this);
$element = new Zend_Form_Element_Submit('post');
$element->setLabel('提交')->removeDecorator('Label');
$this->addElement($element);
$this->addDisplayGroup(array('password', 'captcha', 'post'), 'leftMargin');
$this->getDisplayGroup('leftMargin')->removeDecorator('DtDdWrapper');
}
示例5: __construct
public function __construct($forSearch = false)
{
parent::__construct();
if ($forSearch) {
$radioKind = new Zend_Form_Element_Radio('kind');
$radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
$radioKind->setValue('and');
$radioKind->setLabel('Search field combination:');
$radioKind->setRequired(true);
$this->addElement($radioKind);
}
$this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true));
$this->addElement('hidden', CalibrationExercise::COL_WORKSHOP_ID, array('required' => true));
$valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
$valiAlnumWhiteSpace = new Zend_Validate_Alnum(true);
$this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
$this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
$this->addElement(new Default_Form_Element_KeyTableSelect(CalibrationExercise::COL_KEY_TABLE_ID, array('label' => 'Protocol:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))));
$this->addElement(new Default_Form_Element_ExpertiseSelect(CalibrationExercise::COL_EXPERTISE_ID, array('label' => 'Expertise:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace))));
$this->addElement('checkbox', CalibrationExercise::COL_COMPAREABLE, array('label' => 'Show comparable other user/group annotations/references:', 'required' => true));
$this->addElement('checkbox', CalibrationExercise::COL_RANDOMIZED, array('label' => 'Allow adding images to image set at random:', 'required' => true));
$this->addElement('submit', 'save', array('label' => 'Save'));
$this->addElement('hidden', 'Token');
$this->addElement('hidden', CalibrationExercise::COL_IS_STOPPED);
}
示例6: _initVOType
public function _initVOType()
{
$element = new Zend_Form_Element_Radio('vo_type');
$element->addMultiOptions(array('MIXED' => 'Mixed', 'GROUP' => 'Group', 'STEM' => 'Stem', 'IDP' => 'IdP'));
$element->setRequired(true);
$element->setAllowEmpty(false);
$element->setValue('MIXED');
return $this->addElement($element);
}
示例7: buildCat2Element
protected function buildCat2Element()
{
$cat2 = new Zend_Form_Element_Radio('cat2');
$cat2->setLabel($this->_business->getCat2Name());
$cat2->addMultiOptions($this->_business->getCat2Array(null, false));
$cat2->setValue($this->_business->getFirstCat2(null, false));
$cat2->setAttrib('class', 'refineformselect');
$cat2->setAttrib('onclick', "changeCat2(this.id,this.value, '/ajax/realestate/changecat2/')");
$this->addElement($cat2);
}
示例8: renderFormElement
public function renderFormElement()
{
$elm = new Zend_Form_Element_Radio($this->getName(), array('label' => $this->getLabel() . ':'));
$elm->setDescription($this->getDescription());
$elm->setMultiOptions($this->_rankingOptions);
$elm->setValue($this->getValue());
$elm->setRequired($this->getRequired());
$elm->setSeparator('');
return $elm;
}
示例9: buildCat1Element
protected function buildCat1Element()
{
$cat1 = new Zend_Form_Element_Radio('cat1');
$cat1->setLabel($this->_business->getCat1Name());
$cat1->setMultiOptions($this->_business->getCat1Array());
//$cat1->setValue($this->_business->getFirstCat1());
logfire('FFFkey', $this->_business->getFirstCat1());
$cat1->setValue($this->_business->getFirstCat1());
$cat1->setAttrib('class', 'refineformselect');
$this->addElement($cat1);
}
示例10: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'feedforwardinit');
$id = new Zend_Form_Element_Hidden('id');
$postid = Zend_Controller_Front::getInstance()->getRequest()->getParam('id');
$appraisal_mode = new Zend_Form_Element_Select('appraisal_mode');
$appraisal_mode->setLabel("Appraisal");
$appraisal_mode->setMultiOptions(array('' => 'Select Appraisal'));
$appraisal_mode->setAttrib('class', 'selectoption');
$appraisal_mode->setRequired(true);
$appraisal_mode->addValidator('NotEmpty', false, array('messages' => 'Please select appraisal.'));
$status = new Zend_Form_Element_Select('status');
$status->setLabel("Status");
$status->setAttrib('class', 'selectoption');
$status->setMultiOptions(array('1' => 'Open'));
//,'2' => 'Close'
$status->setRegisterInArrayValidator(false);
$status->setRequired(true);
$status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
$employee_name_view = new Zend_Form_Element_Radio('employee_name_view');
$employee_name_view->setLabel("Employee Details");
$employee_name_view->addMultiOptions(array('1' => 'Show', '0' => 'Hide'));
$employee_name_view->setSeparator('');
$employee_name_view->setValue(0);
$employee_name_view->setRegisterInArrayValidator(false);
$enable_to = new Zend_Form_Element_MultiCheckbox('enable_to');
$enable_to->setLabel("Enable To");
$enable_to->addMultiOptions(array('0' => 'Appraisal Employees', '1' => 'All Employees'));
$enable_to->setSeparator('');
$enable_to->setValue(0);
$enable_to->setRequired(true);
$enable_to->setRegisterInArrayValidator(false);
$enable_to->addValidator('NotEmpty', false, array('messages' => 'Please check enable to.'));
$ff_due_date = new Zend_Form_Element_Text('ff_due_date');
$ff_due_date->setLabel("Due Date");
$ff_due_date->setOptions(array('class' => 'brdr_none'));
$ff_due_date->setRequired(true);
$ff_due_date->addValidator('NotEmpty', false, array('messages' => 'Please select due date.'));
$save = new Zend_Form_Element_Submit('submit');
$save->setAttrib('id', 'submitbutton');
$save->setLabel('Save & Initialize');
$save_later = new Zend_Form_Element_Submit('submit');
$save_later->setAttrib('id', 'submitbutton1');
$save_later->setLabel('Save & Initialize Later');
$this->addElements(array($id, $appraisal_mode, $status, $employee_name_view, $ff_due_date, $save, $save_later, $enable_to));
$this->setElementDecorators(array('ViewHelper'));
}
示例11: __construct
public function __construct($forSearch = false)
{
parent::__construct();
if ($forSearch) {
$radioKind = new Zend_Form_Element_Radio('kind');
$radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
$radioKind->setValue('and');
$radioKind->setLabel('Search field combination:');
$radioKind->setRequired(true);
$this->addElement($radioKind);
}
$this->addElement('hidden', CalibrationExercise::COL_ID, array('required' => true));
$valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
$valiAlnumWhiteSpace = new Zend_Validate_Alnum(true);
$this->addElement('text', CalibrationExercise::COL_NAME, array('label' => 'Calibration exercise name:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
$this->addElement('text', CalibrationExercise::COL_DESCRIPTION, array('label' => 'Description:', 'required' => true, 'validators' => array($valiAlnumWhiteSpace)));
$this->addElement('submit', 'save', array('label' => 'Save'));
$this->addElement('hidden', 'Token');
}
示例12: init
public function init()
{
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))));
$defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
$defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();
//Station name
$this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => _('Station Name'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
//Default station fade in
$this->addElement('text', 'stationDefaultCrossfadeDuration', array('class' => 'input_text', 'label' => _('Default Crossfade Duration (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), 'decorators' => array('ViewHelper')));
//Default station fade in
$this->addElement('text', 'stationDefaultFadeIn', array('class' => 'input_text', 'label' => _('Default Fade In (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeIn, 'decorators' => array('ViewHelper')));
//Default station fade out
$this->addElement('text', 'stationDefaultFadeOut', array('class' => 'input_text', 'label' => _('Default Fade Out (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeOut, 'decorators' => array('ViewHelper')));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel(sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
$third_party_api->setMultiOptions(array(_("Disabled"), _("Enabled")));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
$locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Default Interface Language"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetDefaultLocale());
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
/* Form Element for setting the Timezone */
$timezone = new Zend_Form_Element_Select("timezone");
$timezone->setLabel(_("Station Timezone"));
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
$timezone->setValue(Application_Model_Preference::GetDefaultTimezone());
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
/* Form Element for setting which day is the start of the week */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
$week_start_day->setLabel(_("Week Starts On"));
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
}
示例13: startFrom
public function startFrom()
{
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel(_('Hardware Audio Output'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
$output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel(_("Output Type"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper'));
if ($setting['output_sound_device'] != "true") {
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false") {
$icecast_vorbis_metadata->setAttrib("readonly", true);
}
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel(_('Stream Label:'));
$stream_format->setMultiOptions(array(_("Artist - Title"), _("Show - Artist - Title"), _("Station name - Show name")));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
$offAirMeta->setLabel(_('Off Air Metadata'))->setValue(Application_Model_StreamSetting::getOffAirMeta())->setDecorators(array('ViewHelper'));
$this->addElement($offAirMeta);
$enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain");
$enable_replay_gain->setLabel(_("Enable Replay Gain"))->setValue(Application_Model_Preference::GetEnableReplayGain())->setDecorators(array('ViewHelper'));
$this->addElement($enable_replay_gain);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))->setValue(Application_Model_Preference::getReplayGainModifier())->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
}
示例14: __construct
public function __construct($forSearch = false)
{
parent::__construct();
if ($forSearch) {
$radioKind = new Zend_Form_Element_Radio('kind');
$radioKind->addMultiOptions(array('and' => 'and', 'or' => 'or'));
$radioKind->setValue('and');
$radioKind->setLabel('Search field combination:');
$radioKind->setRequired(true);
$this->addElement($radioKind);
}
$valiAlphaWhiteSpace = new Zend_Validate_Alpha(true);
$this->addElement('hidden', User::COL_ID, array('required' => true));
$this->addElement('text', User::COL_USERNAME, array('label' => 'Username = e-mail adress:', 'required' => true, 'validators' => array('EmailAddress', array('StringLength', false, array(6, 40)))));
$this->addElement('text', User::COL_FIRSTNAME, array('label' => 'First name:', 'required' => true, 'validators' => array($valiAlphaWhiteSpace)));
$this->addElement('text', User::COL_LASTNAME, array('label' => 'Last name:', 'required' => true, 'validators' => array($valiAlphaWhiteSpace)));
$this->addElement('password', User::COL_PASSWORD, array('label' => 'Password:', 'required' => true, 'validators' => array(array('StringLength', false, array(6, 20)))));
$this->addElement('password', self::PASSWORD_CLONE, array('label' => 'Repeat Password:', 'required' => true));
//due to the rule username=e-mail adress, this field is not viewed
/* $this->addElement('text', User::COL_EMAIL, array( 'label'=>'E-mail adress:',
'required'=>true,
'validators'=>array('EmailAddress')));*/
$institutionSelect = new Default_Form_Element_ValuelistSelect(603, User::COL_INSTITUTION);
$institutionSelect->setRequired(true);
$institutionSelect->setLabel('Institution:');
$this->addElement($institutionSelect);
$this->addElement('text', User::COL_STREET, array('label' => 'Street:', 'validators' => array(new Zend_Validate_Alnum(true))));
$this->addElement('text', User::COL_CITY, array('label' => 'City:', 'validators' => array($valiAlphaWhiteSpace)));
$this->addElement('text', User::COL_PHONE, array('label' => 'Phone number:'));
$this->addElement('text', User::COL_FAX, array('label' => 'Faxsimile number:'));
$countrySelect = new Default_Form_Element_ValuelistSelect(602, User::COL_COUNTRY);
$countrySelect->setRequired(true);
$countrySelect->setLabel('Country:');
$this->addElement($countrySelect);
$this->addElement('checkbox', User::COL_ACTIVE, array('label' => 'Active:'));
$this->addElement('hidden', User::COL_GUID);
$this->addElement('submit', 'submit', array('label' => 'Submit'));
$this->addElement('hidden', 'Token');
$this->setElementFilters(array('StringTrim'));
}
示例15: init
public function init()
{
$this->setMethod('post')->setAttrib('id', 'frmTest')->setAttrib('enctype', 'multipart/form-data');
// Elemento: Nombre
$e = new Zend_Form_Element_Text('nombre');
$e->setLabel('Nombre');
$e->setFilters(array('StringToLower'));
$this->addElement($e);
// Elemento: activo
$e = new Zend_Form_Element_Checkbox('activo');
$e->setLabel('Activo');
$this->addElement($e);
// Elemento: activo2
$e = new Zend_Form_Element_Radio('activo2');
$e->setLabel('Activo2');
$_cat = new Application_Model_Categoria();
$values = $_cat->getComboValues();
$e->setMultiOptions($values);
$e->setValue(array_rand($values));
$v = new Zend_Validate_InArray(array_keys($values));
$this->addElement($e);
$e = new Zend_Form_Element_File('imagen');
$e->setLabel('Upload an image:');
$e->setDestination(APPLICATION_PATH . '/../public/uploads/');
$f = new Zend_Filter_File_Rename(array('target' => '123.jpg'));
// Renombrar archivo
$e->addFilter($f);
$e->addValidator('Count', false, 1);
// Solo 1 archivo
$e->addValidator('Size', false, 102400);
// limite de 100K
$e->addValidator('Extension', false, 'jpg,png,gif');
// solo JPEG, PNG, and GIFs
$this->addElement($e);
$this->addElement('submit', 'Enviar');
}