When i open one of my items with the tag playground.
The value of the autocomplete textfield in my form will be "playground, " (without quotes). When i type swimmingpool and select that one from the auto complete list the value of the field will change to: "swimmingpool, swim, " instead of "playground, swimmingpool, ".
I am having the same problem - anyone found a solution?
I also tried upgrading to 1.1.1 and now autocomplete doesn’t work at all. It doesn’t even try to do AJAX or give any JS errors in either IE or Firefox - its simply does nothing (tried deleting the assets folders in case it was a cache issue).
With 1.1.0, IE does actually work if you select the option from the suggested list using the up/down keys, but if you select using the MOUSE, it screws up - the new selection overwrites the first and leaves the typed characters at the end. Maybe some issue with the cursor position being changed to the start of the text box when you click the menu?
Regarding 1.1.1, I saw the other messsage about the conflict between Jui, so I assume that is why it doesn’t work at all. I agree about using an RC for JQuery and although I have read the note about using clientScript->scriptMap, I have to say that it is not very clear to me how to do this: could someone give an exact example of how to force it to use the old version?
I have used CAutoComplete in a couple of recent projects with no problem in IE.
Here is a working controller action for review if needed:
public function actionAutoCompleteLookup()
{
if(Yii::app()->request->isAjaxRequest && isset($_GET['q']))
{
/* q is the default GET variable name that is used by
/ the autocomplete widget to pass in user input
*/
$name = $_GET['q'];
// this was set with the "max" attribute of the CAutoComplete widget
$limit = min($_GET['limit'], 50);
$criteria = new CDbCriteria;
$criteria->select = "city";
$criteria->distinct=true;
$criteria->condition = "city LIKE :sterm";
$criteria->params = array(":sterm"=>"$name%");
//$criteria->order = "city";
$criteria->limit = $limit;
$resultArray = geocity::model()->findAll($criteria);
$returnVal = '';
foreach($resultArray as $result)
{
$returnVal .= $result->getAttribute('city'). "\n";
}
echo $returnVal;
}
}
Thanks, but I don’t think the controller is the issue - as I say it works perfectly with FF and it also happens with the Yii Blog Demo (which is where I copied the code from!). It always happens with Vista/W7+IE8 if you select using the mouse (rather than the arrow keys).
Your one only allows a single choice - perhaps I didn’t explain that. This issue only happens with multiple selections - the 1st is always fine, but try adding a comma and a 2nd entry using the mouse…
You’re right, this was done some time ago but I’m working on another project with similar auto-complete on town/city - using only the latest Yii 1.1.1 and again it works fine in IE.
Thanks for your help. Have you reported this as a bug to them? There is a TODO comment in the code (Line 226) about cursor positioning, so perhaps this is related.
[html]
// TODO this should set the cursor to the right position, but it gets overriden somewhere