本文整理汇总了PHP中Zend\Form\Element\Select::setDisableInArrayValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::setDisableInArrayValidator方法的具体用法?PHP Select::setDisableInArrayValidator怎么用?PHP Select::setDisableInArrayValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element\Select
的用法示例。
在下文中一共展示了Select::setDisableInArrayValidator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(EntityManager $em, $name = null, $options = array())
{
$this->em = $em;
parent::__construct('BankDetailsForm');
$this->setAttribute('method', 'post');
$this->setAttribute('class', 'form-horizontal');
$city = new Element\Select('cityId');
$city->setLabel('city');
$city->setValueOptions($this->getOptionCity());
$city->setAttribute("class", "dropDnInput");
$city->setAttribute("id", "cityId");
$city->setDisableInArrayValidator(true);
$this->add($city);
$bankName = new Element\Select('bankName');
$bankName->setLabel('Bank Name');
$bankName->setValueOptions($this->getOptionBankNames());
$bankName->setAttribute("class", "dropDnInput");
$this->add($bankName);
$this->add(array('name' => 'branchName', 'attributes' => array('type' => 'text', 'placeholder' => 'Branch Name', 'class' => 'commonDropDnInput')));
$this->add(array('name' => 'ifscCode', 'attributes' => array('type' => 'text', 'placeholder' => 'IFSC code', 'class' => 'commonDropDnInput')));
$this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue")));
// $this->add(array(
// 'name' => 'cancel',
// 'attributes' => array(
// 'type' => 'cancel',
// 'value' => 'Cancel',
// 'class' => 'btn btn-primary',
// ),
// 'options' => array(
// 'label' => 'Cancel'
// ),
// ));
}
示例2: __construct
public function __construct(EntityManager $em, $name = null, $options = array())
{
$this->em = $em;
// we want to ignore the name passed
parent::__construct('vehiclemodel');
$this->setAttribute('method', 'post');
$this->add(array('name' => 'vehicleModelId', 'attributes' => array('type' => 'hidden')));
$vehicleBrand = new Element\Select('vehicleBrandId');
$vehicleBrand->setAttributes(array('class' => 'dropDnInput'));
$vehicleBrand->setEmptyOption("Select Brand");
$vehicleBrand->setValueOptions($this->getOptionsForSelectBrands());
$vehicleBrand->setDisableInArrayValidator(TRUE);
$this->add($vehicleBrand);
$this->add(array('name' => 'vehicleModelName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Vehicle Model Name')));
$this->add(array('name' => 'status', 'type' => 'Select', 'attributes' => array('class' => 'dropDnInput'), 'options' => array('empty_option' => 'Select Status', 'value_options' => array('0' => 'InActive', '1' => 'Active'))));
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'vehiclModeladd', 'id' => 'submitbutton', 'class' => "btn-blue")));
}
示例3: __construct
public function __construct(EntityManager $em, $name = null, $options = array())
{
$this->em = $em;
parent::__construct('toll');
$this->setAttribute('method', 'post');
$this->add(array('name' => 'tollName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Toll Name')));
$city = new Element\Select('cityId');
$city->setEmptyOption("Select City Name");
$city->setAttributes(array("id" => "cityId"));
$city->setAttributes(array("class" => "dropDnInput"));
// $city->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput'));
$city->setValueOptions($this->getOptionsForSelectCity());
$this->add($city);
$locationId = new Element\Select('locationId');
$locationId->setEmptyOption("Select Location Name");
// $locationId->setAttributes("id","location");
$locationId->setAttributes(array("id" => "location"));
$locationId->setAttributes(array("class" => "dropDnInput"));
// $locationId->setAttributes(array('onChange'=>'setter("city",this.options[this.selectedIndex].text)','class'=>'dropDnInput'));
$locationId->setValueOptions($this->getOptionsForSelectLocation());
$locationId->setDisableInArrayValidator(true);
$this->add($locationId);
$this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Go', 'id' => 'submitbutton', 'class' => "btn-blue")));
}
示例4: testDisableInputSpecification
public function testDisableInputSpecification()
{
$element = new SelectElement();
$element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
$element->setDisableInArrayValidator(true);
$inputSpec = $element->getInputSpecification();
$this->assertArrayNotHasKey('validators', $inputSpec);
}
示例5: __construct
public function __construct(EntityManager $em, $name = null, $options = array())
{
$this->em = $em;
parent::__construct('LocationForm');
$this->setAttribute('method', 'post');
$this->setAttribute('enctype', 'multipart/form-data');
$this->setAttribute('class', 'form-horizontal');
$this->add(array('name' => 'locname', 'attributes' => array('type' => 'text', 'placeholder' => 'Location name', 'class' => 'commonDropDnInput')));
$stid = new Element\Select('stid');
$stid->setLabel('State');
$stid->setValueOptions(array('' => 'State'));
$stid->setValueOptions($this->getOptionState());
$stid->setAttributes(array('id' => 'state'));
$stid->setAttribute("class", "dropDnInput");
$stid->setDisableInArrayValidator(true);
$this->add($stid);
$ctid = new Element\Select('ctid');
$ctid->setLabel('City');
$ctid->setAttributes(array('id' => 'city'));
$ctid->setValueOptions(array('' => 'City'));
$ctid->setAttribute("class", "dropDnInput");
$ctid->setDisableInArrayValidator(true);
$this->add($ctid);
$locationtype = new Element\Select('loctypeid');
$locationtype->setLabel('Location Type');
$locationtype->setValueOptions($this->getOptionLocationType());
$locationtype->setAttribute("class", "dropDnInput");
$this->add($locationtype);
$bestSeasonToVisit = new Element\Textarea('bestSeasonToVisit');
$bestSeasonToVisit->setLabel('Best Season to visit');
$bestSeasonToVisit->setAttribute("class", "selectAreaInput");
$bestSeasonToVisit->setAttribute("rows", "4");
$bestSeasonToVisit->setAttribute("cols", "50");
$this->add($bestSeasonToVisit);
$entry = new Element\Select('entry');
$entry->setLabel('Entry');
$entry->setValueOptions(array('' => 'Entry', '1' => 'Yes', '2' => 'No'));
$entry->setAttribute("class", "dropDnInput");
$this->add($entry);
$timingOpeningNClosing = new Element\Textarea('timingOpeningNClosing');
$timingOpeningNClosing->setLabel('Opening and closing timing');
$timingOpeningNClosing->setAttribute("class", "selectAreaInput");
$timingOpeningNClosing->setAttribute("rows", "4");
$timingOpeningNClosing->setAttribute("cols", "50");
$this->add($timingOpeningNClosing);
$description = new Element\Textarea('description');
$description->setLabel('Description');
$description->setAttribute("class", "selectAreaInput");
$description->setAttribute("rows", "4");
$description->setAttribute("cols", "50");
$this->add($description);
$specialInstructions = new Element\Textarea('specialInstructions');
$specialInstructions->setLabel('Special Instruction Description');
$specialInstructions->setAttribute("class", "selectAreaInput");
$specialInstructions->setAttribute("rows", "4");
$specialInstructions->setAttribute("cols", "50");
$this->add($specialInstructions);
$notAllowed = new Element\Textarea('notAllowed');
$notAllowed->setLabel('Not allowed reason');
$notAllowed->setAttribute("class", "selectAreaInput");
$notAllowed->setAttribute("rows", "4");
$notAllowed->setAttribute("cols", "50");
$this->add($notAllowed);
$airportRailwayStatus = new Element\Select('airportRailwayStatus');
$airportRailwayStatus->setLabel('Airport/Railway');
$airportRailwayStatus->setValueOptions(array('' => 'Select', '1' => 'Yes', '2' => 'No'));
$airportRailwayStatus->setAttribute("class", "dropDnInput");
$this->add($airportRailwayStatus);
$this->add(array('name' => 'citytemp', 'attributes' => array('type' => 'hidden', 'placeholder' => 'citytemp', 'class' => 'commonDropDnInput', 'id' => 'citytemp')));
$this->add(array('name' => 'latitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Lattitude', 'class' => 'commonDropDnInput')));
$this->add(array('name' => 'longitude', 'attributes' => array('type' => 'text', 'placeholder' => 'City Longitude', 'class' => 'commonDropDnInput')));
$this->add(array('name' => 'locationPhoto', 'attributes' => array('type' => 'file'), 'options' => array('label' => 'File Upload')));
$this->add(array('name' => 'save', 'attributes' => array('type' => 'submit', 'value' => 'Submit', 'class' => "btn-blue")));
// $this->add(array(
// 'name' => 'cancel',
// 'attributes' => array(
// 'type' => 'cancel',
// 'value' => 'Cancel',
// 'class' => 'btn btn-primary',
// ),
// 'options' => array(
// 'label' => 'Cancel'
// ),
// ));
}
示例6: init
/** {@inheritdoc} */
public function init()
{
parent::init();
$translator = $this->getOption('translator');
$this->_filters = array('Name' => $translator->translate('Name'), 'UserName' => $translator->translate('User name'), 'Windows.UserDomain' => $translator->translate('User domain'), 'Windows.Workgroup' => $translator->translate('Workgroup'), 'OsName' => $translator->translate('OS name'), 'OsVersionNumber' => $translator->translate('OS version number'), 'OsVersionString' => $translator->translate('OS version string'), 'Windows.CpuArchitecture' => $translator->translate('OS architecture'), 'OsComment' => $translator->translate('OS comment'), 'Windows.ProductKey' => $translator->translate('Windows product key'), 'Windows.ManualProductKey' => $translator->translate('Windows product key (manual)'), 'Software.Name' => $translator->translate('Software: Name'), 'Software.Version' => $translator->translate('Software: Version'), 'Software.Publisher' => $translator->translate('Software: Publisher'), 'Software.Comment' => $translator->translate('Software: Comment'), 'Software.InstallLocation' => $translator->translate('Software: Install location'), 'MsOfficeProduct.ProductKey' => $translator->translate('MS Office product key'), 'MsOfficeProduct.ProductId' => $translator->translate('MS Office product ID'), 'InventoryDate' => $translator->translate('Last inventory'), 'LastContactDate' => $translator->translate('Last contact'), 'CpuType' => $translator->translate('CPU type'), 'CpuClock' => $translator->translate('CPU clock (MHz)'), 'CpuCores' => $translator->translate('CPU cores'), 'PhysicalMemory' => $translator->translate('Physical memory'), 'SwapMemory' => $translator->translate('Swap memory'), 'Manufacturer' => $translator->translate('Manufacturer'), 'ProductName' => $translator->translate('Model'), 'Serial' => $translator->translate('Serial number'), 'AssetTag' => $translator->translate('Asset tag'), 'BiosVersion' => $translator->translate('BIOS version'), 'BiosDate' => $translator->translate('BIOS date'), 'Filesystem.Size' => $translator->translate('Filesystem size (MB)'), 'Filesystem.FreeSpace' => $translator->translate('Filesystem free space (MB)'), 'DnsServer' => $translator->translate('DNS server'), 'DefaultGateway' => $translator->translate('Default gateway'), 'NetworkInterface.IpAddress' => $translator->translate('IP address'), 'NetworkInterface.MacAddress' => $translator->translate('MAC address'), 'NetworkInterface.Subnet' => $translator->translate('Network address'), 'NetworkInterface.Netmask' => $translator->translate('Network Mask'), 'Printer.Name' => $translator->translate('Printer name'), 'Printer.Port' => $translator->translate('Printer port'), 'Printer.Driver' => $translator->translate('Printer driver'), 'UserAgent' => $translator->translate('User agent'), 'Display.Manufacturer' => $translator->translate('Monitor: manufacturer'), 'Display.Description' => $translator->translate('Monitor: description'), 'Display.Serial' => $translator->translate('Monitor: serial'), 'Display.Edid' => $translator->translate('Monitor: EDID'), 'DisplayController.Name' => $translator->translate('Display controller'), 'DisplayController.Memory' => $translator->translate('GPU memory'), 'Modem.Name' => $translator->translate('Modem'), 'AudioDevice.Name' => $translator->translate('Audio device'), 'Port.Name' => $translator->translate('Port name'));
// Append filters and labels for registry values/data
foreach ($this->getOption('registryManager')->getValueDefinitions() as $regValue) {
$name = $regValue['Name'];
$this->_filters["Registry.{$name}"] = "Registry: {$name}";
}
// Append filters and labels for user defined info
$template = $translator->translate('User defined: %s');
foreach ($this->getOption('customFieldManager')->getFields() as $name => $type) {
$key = "CustomFields.{$name}";
switch ($type) {
case 'text':
case 'clob':
break;
case 'integer':
case 'float':
case 'date':
$this->_types[$key] = $type;
break;
default:
throw new \UnexpectedValueException('Unsupported datatype: ' . $type);
}
if ($name == 'TAG') {
$label = $translator->translate('Category');
} else {
$label = $name;
}
$this->_filters[$key] = sprintf($template, $label);
}
$filter = new Element\Select('filter');
$filter->setLabel('Search for')->setAttribute('type', 'select_untranslated')->setAttribute('onchange', 'filterChanged();')->setValueOptions($this->_filters);
$this->add($filter);
$search = new Element\Text('search');
$search->setLabel('Value');
$this->add($search);
// Operators dropdown. Options are set by JS depending on filter type.
// Since valid options are known only after submission, the internal
// InArray validator must be disabled and replaced by a callback.
$operator = new Element\Select('operator');
$operator->setDisableInArrayValidator(true)->setLabel('Operator');
$this->add($operator);
$invert = new Element\Checkbox('invert');
$invert->setLabel('Invert results');
$this->add($invert);
$submit = new \Library\Form\Element\Submit('customSearch');
$submit->setLabel('Search');
$this->add($submit);
$inputFilter = new \Zend\InputFilter\InputFilter();
$inputFilter->add(array('name' => 'search', 'continue_if_empty' => true, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'filterSearch')))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateSearch'))))));
$inputFilter->add(array('name' => 'operator', 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateOperator'))))));
$this->setInputFilter($inputFilter);
$this->_operatorsText = array('like' => $translator->translate("Substring match, wildcards '?' and '*' allowed"), 'eq' => $translator->translate('Exact match'));
}