當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Form::addIntegerPicker方法代碼示例

本文整理匯總了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;
 }
開發者ID:rostenkowski,項目名稱:vstore,代碼行數:18,代碼來源:CartControl.php

示例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;
 }
開發者ID:rostenkowski,項目名稱:vstore,代碼行數:21,代碼來源:AddToCartProcess.php


注:本文中的Nette\Application\UI\Form::addIntegerPicker方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。