本文整理汇总了PHP中Nette\Application\UI\Form::addIntegerPicker方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addIntegerPicker方法的具体用法?PHP Form::addIntegerPicker怎么用?PHP Form::addIntegerPicker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addIntegerPicker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentCartForm
public function createComponentCartForm($name)
{
// Nevolat v konstruktoru, protoze, pokud se jedna o handling akce (?do=cartControl-default), tak je konstruktor
// zavolan jeste pred sablonou a nema tudiz nastavene potrebne vazby (resilo by to attached()?)
IntegerPicker::register();
$form = new Form($this, $name);
$form->onSuccess[] = callback($this, 'cartFormSubmitted');
foreach ($this->order->getItems(true) as $item) {
$form->addCheckbox('check' . $item->uniqueId);
$form->addIntegerPicker('range' . $item->uniqueId)->setDefaultValue($item->amount)->addRule(function ($control) {
return $control->value >= 0;
}, 'Zadané číslo musí byt nula či vyšší')->addRule(Form::FILLED, 'Vyplňte prosím počet produktů');
}
$form->addSubmit('delete', 'Delete selected');
$form->addSubmit('reCount', 'Recount');
$form->addSubmit('buy', 'Buy');
return $form;
}
示例2: createComponentAdjustOrderForm
public function createComponentAdjustOrderForm($name)
{
vBuilder\Application\UI\Form\IntegerPicker::register();
$form = new Form($this, $name);
$form->addHidden('ids');
if ($form->isSubmitted()) {
$this->setProductIds(explode(',', $form->values->ids));
} else {
$form['ids']->setDefaultValue(implode(',', $this->getProductIds()));
}
foreach ($this->products as $product) {
$form->addIntegerPicker('amount' . $product->pageId)->setDefaultValue(1)->addRule(function ($control) {
return ctype_digit($control->value);
}, 'The amount must be a number!');
}
$form->onSuccess[] = callback($this, $name . 'Submitted');
$form->onError[] = callback($this, $name . 'Error');
$form->addProtection();
$form->addSubmit('s', 'Přidat do košíku');
return $form;
}