Cascading into auto-complete text box
I have a web page where a user enters their address. They will select their country and region from the cascading dropdown lists. I would like to provide an auto-update textbox for my city, but I want to be contextual for country and region selection. I would just use another cascading dropdown list however the number of cities exceeds the maximum number of list items.
Any suggestions or cool spinels that might help me?
source to share
I just found the following blog post that looks at least close to what you want.
They control it using the following javascript functions:
function initCascadingAutoComplete() {
var moviesAutoComplete = $find('autoCompleteBehavior1');
var actorsAutoComplete = $find('autoCompleteBehavior2');
actorsAutoComplete.set_contextKey(moviesAutoComplete.get_element().value);
moviesAutoComplete.add_itemSelected(cascade);
// setup initial state of second flyout
if (moviesAutoComplete.get_element().value) {
actorsAutoComplete.get_element().disabled = false;
} else {
actorsAutoComplete.get_element().disabled = true;
actorsAutoComplete.get_element().value = "";
}
}
function cascade(sender, ev) {
var actorsAutoComplete = $find('autoCompleteBehavior2');
actorsAutoComplete.set_contextKey(ev.get_text());
actorsAutoComplete.get_element().value = '';
if (actorsAutoComplete.get_element().disabled) {
actorsAutoComplete.get_element().disabled = false;
}
}
Sys.Application.add_load(initCascadingAutoComplete);
Calling the cascade function in the add_itemSelected method of the parent control for cascading behavior.
They cascade the contents of one auto full expander to another instead of taking a cascading dropdown, but hopefully you can reuse some of the ideas.
source to share