Hi there,

I have a nicely formatted JSON file that looks like:

{
   "stations" : {
      "F07A" : {
         "calibration" : "1212797922",
         "construction" : "1152736320",
         "calibrationplot" : 1222258922,
         "service" : [
            "1186011098",
            "1209718352",
            "1213577558",
            "1214081337",
            "1220576523"
         ],
         "installation" : "1157069307"
      },
     <snip>
      "S08C" : {
         "dlevent" : "1196697107",
         "removal" : "1192723069",
         "service" : [
            "1127293181",
            "1154632570",
            "1157479149"
         ],
         "installation" : "1123277295"
      }
   }
}

It consists of the 'stations' object, with keys that are station
names, then an object that has station visit type and an associated
timestamp. If there is more than one visit, then an array is created
(such as 'service' in my snippet above).

I am using Jorn's awesome autocomplete plugin in one form field to
allow a user to quickly narrow down which station they wish to view
visit times for. However, it would be really cool to extend this so
that when the selection is narrowed to one station, there is another
form input field listing all the available visit types that is
populated from the JSON file as well. I have seen this with simple
javascript arrays  from way back (eg: 
http://www.plus2net.com/php_tutorial/dd3.php)
but I was wondering if anyone has implemented such as setup using the
autocomplete plugin (or another plugin).

I see in the plugin API there is a 'multiple' option, but that appears
to be for the same text field. I guess I will have to write a call-
back function when autocomplete narrows the search to one in the first
input field, but I am not sure how to bind them. Any ideas?

Thanks in advance.

Reply via email to