Adding The Value Of Two Dropdowns And Submitting Them In A Hidden Field?

Hi,

I am trying to add the value from two dropdowns together, and then submit them in another hidden field. How do I reference the values that have been selected in the drop downs? If I could add them and put them in to the ‘value’ field of the hiddenField that would be ideal because I know that value gets submitted because I tried putting in 12345 in the value field and that worked.

My sudo code would look something like


<?php echo $form->hiddenField($model,'kickoff',array('value'=>'value of kickoff1'+'value of kickoff2')); ?>

here is how my dropdowns look


<?php echo CHtml::dropDownList('kickoff1','', array('08' => '08', 

		'09' => '09',

		'10' => '10',

		'11' => '11',

		'12' => '12',

		'13' => '13',

		'14' => '14',

		'15' => '15',

		'16' => '16',

		'17' => '17',

		'18' => '18',

		'19' => '19',

		'20' => '20',

		)); ?>

		<?php echo CHtml::dropDownList('kickoff2','', array('00' => '00', 

		'05' => '05',

		'10' => '10',

		'15' => '15',

		'20' => '20',

		'25' => '25',

		'30' => '30',

		'35' => '35',

		'40' => '40',

		'45' => '45',

		'50' => '50',

		'55' => '55',

		)); ?>

If anyone knows an easier way to go about selecting a time, that would be amazing, the only plugin i can find is the timepicker, and i am not looking for a slider, i want it as a dropdown.

Thank You!

I think it would make more sense to combine the values in PHP and forget the hidden field completely. That way, you’re not relying on javascript being active in the browser.