Yii Framework Forum: Updating values of a dropdown list with javascript - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Updating values of a dropdown list with javascript Rate Topic: -----

#1 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 02 July 2012 - 02:08 PM

Hi there,

In a form view, I have some javascript function which returns two arrays as the result. I update values of my form after some calculation with values of one array. I wish to update a variable ($room) which is a dropdown list on my form.

Here is my code:
...
...


				$.get("index.php?r=reservation/Calcul", {brd: $("#brd").val(),rmtype: $("#rmtype").val(), nbr:nombre, dt:$("#arr").val() }, function(data) 
				{
					var amt = nb*data.prix;
					adad = $("#add_ad").val();
					adch = $("#add_ch").val();
					amt = amt+(nb*adad*data.prixadd)+(nb*adch*data.prixadd/2);
					$("#amt").val(amt);
					var myarr = data.test;
					$("#test").val(myarr);
				},"json");
			}
	}
	);');
?>
...
...
...

		<?php echo $form->dropDownList($model,'room',$room);?>


I wish to update the values of $room with the values of the array data.test returned by the javascript function. Can anyone please help me? Thanks
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users