本文整理匯總了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;
}