Condor
January 12, 2016, 1:36pm
#1
Hello,
Im using dhtmlxcombo in my html form for cities, but I have troubles about how to combine data with multiple autocomplete fields. I want to make 3 autocomplete fields, first one for city and when user write cityname, cityid is taken and use as param to second autocomplete field to can backend make selection in which city need to select quarts and last filed in which city get streets names.
Can you show me how I can combine two autocompletes ? I tried to look in examples but did not found what I need.
Thanks.
Darya
January 12, 2016, 1:43pm
#2
Hello
But have you seen this sample?
dhtmlx.com/docs/products/dhtmlxC … ombos.html
It is exactly as you described, but for 2 combos. You need just add the 3th one
Condor
January 12, 2016, 1:47pm
#3
Hello,
yes I see it but I cant make it work. Here is my code:
var myCombo;
var myQuart;
function doOnLoad() {
myCombo = new dhtmlXCombo("city", "city", 350);
myCombo.setTemplate({
input: "#word#",
columns: [
{header: "Town", width: 100},
{header: "PO CODE", width: 50},
{header: "Department", width: 100},
{header: "Department 2", width: 100},
]
});
myCombo.enableFilteringMode(true, "loadCity.php", true, true);
myQuart = new dhtmlXCombo("quart", "quart", 350);
myQuart.setTemplate({
input: "#word#",
columns: [
{header: "Type", width: 50},
{header: "QuartName", width: 300},
]
});
myQuart.enableFilteringMode(true);
myCombo.attachEvent("onChange", function(value){
myQuart.clearAll();
myQuart.setComboValue(null);
myQuart.setComboText("");
var citys = value.split(',');
var cityid = citys[0];
if (cityid == null) {
myQuart.disable();
} else {
myQuart.enable();
myQuart.load("loadQuart.php?mask2="+cityid);
}
});
}
</script>
Can you point me where is my mistake ?
Condor
January 12, 2016, 1:51pm
#4
Sorry again, I cant see how to edit my post, I wish to say I want second form also to be autocomplete and dynamic, not static list.
Andrei
January 13, 2016, 12:27pm
#5
Hi
the following one will give you static list:
myQuart.load("loadQuart.php?mask2="+cityid)
try:
myQuart.enableFilteringMode(true, "loadQuart.php?mask2="+cityid, true, true)
Condor
January 14, 2016, 8:38am
#6
Thank you, that’s work like a charm!
Have a nice day!