setOption nefunguje v presenteru
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Stig
- Člen | 29
Po zatrzeni checkboxu chci aby se rozbalil div=„sendBox“. Je to kod
z form examples.
Otazka:
kdyz do dam to presenteru tak nefunguje ->setOption, div=„sendBox“ je
porat otevreny, samostatne jako v examples to funguje.
nevite nekdo?
<?php
protected function createComponentDoprava_platba_form($name)
{
$countries = array(
'Select your country',
'Europe' => array(
'CZ' => 'Czech Republic',
'GB' => 'United Kingdom'));
$form = new NAppForm($this, $name);
$form->addGroup('Shipping address')
->setOption('embedNext', TRUE);
$form->addCheckbox('send', 'Ship to address')
->addCondition(NForm::EQUAL, TRUE) // conditional rule: if is checkbox checked...
->toggle('sendBox'); // toggle div #sendBox
// subgroup
$form->addGroup()
->setOption('container', NHtml::el('div')->id('sendBox'));
$form->addText('street', 'Street:');
$form->addText('city', 'City:')
->addConditionOn($form['send'], NForm::EQUAL, TRUE)
->addRule(NForm::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country:', $countries)
->skipFirst()
->addConditionOn($form['send'], NForm::EQUAL, TRUE)
->addRule(NForm::FILLED, 'Select your country');
$form->addGroup();
$form->addSubmit('submit', 'Send');
return;
?>