DropDownList doesn't respond to onchange event

Hi,

I’m new to Yii, JavaScript and almost new to PHP.

I have a dropdownlist and I would like it to do something when the user selects an item. I attach an action to onchange event. In the example below, it should create an alert box. But nothing happens when the user makes a selection. clientvalidation is enabled and I don’t know if that has anything to do with the problem. Any help would be great. Thanks.


	

<?php $form = $this->beginWidget('CActiveForm', array(

		 'id' => 'register-form',

		 'enableClientValidation' => true,

		 'clientOptions' => array(

			  'validateOnChange' => true,

			  'validateOnSubmit' => true,

		 ),

			  ));

	?>


<?php echo $form->dropDownList($model, 'provider', array('2'=>'Yes', '0'=>'No'), 

				  array('empty'=>'Choose one') 

				  array('onchange'=>'alert(1);')

				  ); ?>



Hello, and welcome.

Have you tried with


<?php echo $form->dropDownList($model, 'provider', array('2'=>'Yes', '0'=>'No'), 

                                  array(

                                          'empty'=>'Choose one', 

                                          'onchange'=>'alert(1);',

                                          )

                                  ); ?>

That works! Thank you so much.