hi all, I am using autocomplete plugin in my form. I am using this autocomplete feature for a textbox inside a div, which is generated by AJAX, anyway autocomplete feature is working properly...I need your advice after selecting a an autopopulated data from textfield, I need to run a javascript function to take the selected data to fill in other column in the same div. So for that, i guess, i need to write simply a function after the autocomplete data selection.. how will i do this.... thanx in advance.....
+1
A:
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("waitimg").innerHTML="";
document.getElementById("ajxform").innerHTML=xmlhttp.responseText;
$(function(){ $("#item_no").autocomplete("auto/finditem.cfm"); })
}
}
<div id="divid">
<input type="text" name="item_no" id="item_no">
<input type="text" >
</div>
so successful population of the div by the above ajax call, i am using autocomplete...
soorajthomas
2010-08-12 12:20:45
+1
A:
assuming you are using this plugin http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ of if another plugin, maby you need a different event but:
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("waitimg").innerHTML="";
document.getElementById("ajxform").innerHTML=xmlhttp.responseText;
$(function(){
$("#item_no").autocomplete("auto/finditem.cfm").result(function(event, data, formatted){
$("#idOfOtherInput").html(formatted);
});
})
}
Haven't tested it, based on this example http://docs.jquery.com/Plugins/Autocomplete/result#handler
red-X
2010-08-12 12:32:50
+1
A:
If you are using the autocomplete-widget from jQuery then you can use the "select" property in the construction like:
$("#textid").autocomplete({select: function(event, ui)
{
// put your code here to write the value into another control
// for this use ui.item.value and ui.item.id
}
Yves M.
2010-08-12 12:44:54