AutoSuggest jQuery Plugin requires an already available Data Object in order to run. I need to use the user's selection from the first input as data in the second input.
The following snippet throws an error in firebug
availableTeachers is not defined
var labs = {lesson:
[
{
name: "FOO LESSON",
professors: [
{ lab: "FOO TEACHER [Monday 3 pm]" },
{ lab: "FOO TEACHER [Thursday 7 pm]" }
]
},
{
name: "FOO LESSON",
professors: [
{ lab: "FOO TEACHER [Tuesday 10 am]" }
]
}
]
};
firstStep.find("form input[type=text]").autoSuggest(labs.lesson, {
selectedItemProp: "name",
searchObjProps: "name",
selectionLimit: 1,
resultClick: function(data){
availableTeachers = data.attributes;
},
});
secondStep.find("form input[type=text]").autoSuggest(availableTeachers.professors, {
selectedItemProp: "lab",
searchObjProps: "lab",
selectionLimit: 1,
});
EDIT
More testing, i predifined availableTeachers
with some dummy data and i populate it with real data after the user selects a lesson.name
in the first input.
Second input keeps seeing only the dummy data
So far, it seems that autoSuggest plugin can only use static Data Objects or JSON requests.