addConditionOn on select IE bug

Notice: This thread is very old.
richard
Member | 60
+
0
-

Hello,

in IE (tested on 7) addConditionOn a select input does not work:

<?php
	protected function createComponentForm()
	{
		$form = new UI\Form;
		$form->addSelect('number','Number:', array('one'=>'one','two'=>'two'))
			->setRequired('Give me number');

		$form->addSelect('one','One:', array('one A','one B'))
			->addConditionOn($form['number'], Nette\Application\UI\Form::EQUAL, 'one')
			->addRule(Nette\Application\UI\Form::FILLED, 'One is mandatory')
			->toggle('tr_one');

		$form->addSubmit('try', 'Try');

		$form->onSuccess[] = callback($this, 'formSubmitted');

		return $form;
	}
?>

This example always throws out error ‘Give me number’ (does not make sense as there is always something in) plus toggle does not work. It works as expected in FF.

IF I change to:

<?php
$form->addSelect('number','Number:', array('one','two'))
/* ... */
	->addConditionOn($form['number'], Nette\Application\UI\Form::EQUAL, 0)
?>

or

<?php
$form->addSelect('number','Number:', array('first'=>'one','second'=>'two'))
/* ... */
	->addConditionOn($form['number'], Nette\Application\UI\Form::EQUAL, 'first')
?>

It works, but I do want to display and log the same value. Here, with getValues(), I get 0 in the first case and ‘first’ in the second. I need to display and log ‘one’.
Wierd thing is, it works with RadioList. It is only IE, Select and when key==value.

Last edited by richard (2011-12-13 04:45)