nastaveni snippet v tovarnicce
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- vosy
- Člen | 532
v navodu je:
/** * Select helper */
private function getCarModelsByType($form) {
$id = $form["car_type"]->value;
$array = $this->models->car->getModelsByType($id); // return array("key" => "name");
return $array; // array is required as return type
}
/** * Form */
protected function createComponentTestForm($name) {
$form = new Form($this, $name); // required for full running
$form->addSelect("car_type", "Car type", array("Opel", "Škoda", "BMW"));
$form->addJSelect("car_model","Model", $form["car_type"], array($this, "getCarModelsByType"));
$form->onSubmit[] = array($this, "testFormSent");
$form->addSubmit("submit", "Save");
return $form;
}
jak se ve funkci private function getCarModelsByType($form)
dostanu na presenter
kdyz dam:
$presenter = $form->getPresenter();
tak je chyba Component '' is not attached to ‚Nette\Application\UI\Presenter‘
- vosy
- Člen | 532
navic i u DependentSelectBox se mi nedari rozbehnout to abych nemusel v latte vykreslovat formular.
V demo ktere jsem si stahnul je take vypsany formular v latte
{snippet formSnippet}
{form form}
{label select1 /} {input select1}
<br>
{input select1_submit}
<br>
{label select2 /} {input select2}
<br>
{input show}
{/form}
{/snippet}
a kdyz latte upravim jen na
{control form}
tak uz to nefunguje asi to bude tim snippet
ale nevim jak toto nastavit pouze v tovarnice daneho formulare tak abych do
late napsal jen
{control form}