Hello to you all! I want to make some changes in my search form so as to perform a search on every key the user presses (something like google-style search).I tried several suggestions from this forum but I am not very experienced with yii nor ajax and didn’t make it.I want to substitute this:
echo CHtml::beginForm(array('microtv4/determine')); $search_params = new Microtv4Search; if( isset( $_POST['keywords'])) $s_keywords = htmlentities($_POST['keywords']); else if( isset( $_GET['keywords'])) $s_keywords = htmlentities($_GET['keywords']); else $s_keywords = ""; echo "<input size=\"70\" name=\"keywords\" id=\"keywords\" type=\"text\" value=\"".$s_keywords."\" title='Search'/>"; echo CHtml::endForm();
What’s the simplest way to perform the search on every key pressed?
If I use something like
echo CHtml::textField('', '', array('id'=>'keywords','width'=>50, 'onkeyup' => CHtml::ajax(array( 'url' => CController::createUrl('/microtv4/determine'), 'type' => 'POST', 'update' => '#content')) ));
to substitute the <input> part, do I have to change the CHtml::Form? Or should I use an Active Form?
I know this sounds messy cause I do not have a full understanding of the framework, so If any more information is needed I would be glad to share it with you. Thank you in advance for your help