Getting Value From Text Field And Sending To The Controller

Hello,

I have a Yiistrap textField and I want to get the value from it when a button is clicked and sent it to the controller? I feel like I am over thinking this. I keep seeing examples using POST & GET but I am not using a form.


<?php echo TbHtml::textField('text', '', array('id' => 'inputSearch', 'value' => 'hello', 'append' => 

	TbHtml::button('test', '', array(

		 'class' => 'lookup',

		 'id' => 'lookup',

		  'color' => TbHtml::BUTTON_COLOR_PRIMARY,

		   //'onclick' => TbHtml::listData(HighSchoolDistrict::model()->findAll(), 'High_School_District_Name', 'High_School_District_Name'),

		  'onclick' => $this->actionDoSomething($('#inputSearch').val()),

		)


	 ))); ?>

Above is my code, onclick is when I want to get the value from the textField and send it to the controller function. Can you guys point me in the right direction?

thanks!

If I got U right, U want to get some value and send it to controller?

I would use for that purpose ajaxButton instead of button, please check this

http://www.yiiframework.com/doc/api/1.1/CHtml#ajaxButton-detail

1 Like