[eluser]yrachmanu[/eluser]
Hi narren,
I've problem with your script, could you help me ??
Here my script,below ( I've just copied your js script onto ownauto.js & load model with reguler SQL not by active record like your example did ),that's all
But, this script implement there nothing happen with the autocomplete, please help me...
Thanks' for your reply
/**************************************
my controller
***************************************/
class autocomplete extends controller
{
function autocomplete(){
parent::Controller();
}
function segment($name)
{
if (isset($name) && strlen($name) > 2)
{
$this->load->model('regionmodel');
$query=$this->regionmodel->getRegion($name);
foreach($query->result() as $row)
echo $row->descrption."\n";
}
}
}
/***************************************
my View
**************************************/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
[removed][removed]
[removed][removed]
[removed][removed]
</head>
<body>
<body>
<input type="hidden" name="segment_id" value="" id="segment_id">
<label for="segment">Segment</label>
<input type="text" name="segment" value="" id="segment">
</body>
</body>
</html>
/**************************
ownauto.js
**************************/
$(document).ready(function() {
$("#segment").autocomplete("/index.php/autocomplete/segment",
{ minChars:3, matchSubset:1, matchContains:1, cacheLength:10,
onItemSelect

electItem, selectOnly:1, elementID:'segment_id' }
);
});
function selectItem(li, elementID) {
$("#"+elementID).val(0);
var setVal = (li.extra) ? li.extra[0] : 0;
$("#"+elementID).val(setVal);
}