| 1 | {{extend 'layout.html'}} |
|---|
| 2 | <style> |
|---|
| 3 | /* Hide the cross street lookup table */ |
|---|
| 4 | .hideme {display: none} |
|---|
| 5 | </style> |
|---|
| 6 | <script> |
|---|
| 7 | /* When a route is selected from the combobox, filter the |
|---|
| 8 | list of locations for just those on that route. */ |
|---|
| 9 | function routechanged() { |
|---|
| 10 | var e = document.getElementById("routecombo"); |
|---|
| 11 | var currentRoute = e.options[e.selectedIndex].text; |
|---|
| 12 | // update the list of locations |
|---|
| 13 | removeOptions(document.getElementById("startlocation")); |
|---|
| 14 | removeOptions(document.getElementById("endlocation")); |
|---|
| 15 | fillOptions(currentRoute); |
|---|
| 16 | } |
|---|
| 17 | // Remove all the options from a combo box |
|---|
| 18 | function removeOptions(selectbox) |
|---|
| 19 | { |
|---|
| 20 | var idx; |
|---|
| 21 | for(idx = selectbox.options.length - 1 ; idx >= 0 ; idx--) |
|---|
| 22 | { |
|---|
| 23 | selectbox.remove(idx); |
|---|
| 24 | } |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | // Fill the selectbox with items from the lookup table that match route |
|---|
| 28 | function fillOptions(route) |
|---|
| 29 | { |
|---|
| 30 | var i; |
|---|
| 31 | var tbl = document.getElementById("stlookup"); |
|---|
| 32 | var startloc = document.getElementById("startlocation") |
|---|
| 33 | var endloc = document.getElementById("endlocation") |
|---|
| 34 | var opt1,opt2; |
|---|
| 35 | |
|---|
| 36 | // Examine all items in cross street lookup table |
|---|
| 37 | for(i = tbl.options.length - 1 ; i >= 0 ; i--) |
|---|
| 38 | { |
|---|
| 39 | var item = tbl.options[i].text; |
|---|
| 40 | // Parse the lookup table item into route and steet fields |
|---|
| 41 | var pos = item.search(","); |
|---|
| 42 | var currentRoute = item.substring(0,pos); |
|---|
| 43 | var currentStreet = item.substring(pos+1); |
|---|
| 44 | // if the crossstreet is for the desired route |
|---|
| 45 | if (route == currentRoute) |
|---|
| 46 | { |
|---|
| 47 | opt1 = document.createElement('option'); |
|---|
| 48 | opt1.text = opt1.value = currentStreet; |
|---|
| 49 | // Add an option to the location combo boxes |
|---|
| 50 | startloc.add(opt1,0); |
|---|
| 51 | opt2 = document.createElement('option'); |
|---|
| 52 | opt2.text = opt2.value = currentStreet; |
|---|
| 53 | endloc.add(opt2,0); |
|---|
| 54 | } |
|---|
| 55 | } |
|---|
| 56 | // Add an empty option to the select box |
|---|
| 57 | opt1 = document.createElement('option'); |
|---|
| 58 | opt1.text = opt1.value = ''; |
|---|
| 59 | startloc.add(opt1,0); |
|---|
| 60 | opt2 = document.createElement('option'); |
|---|
| 61 | opt2.text = opt2.value = ''; |
|---|
| 62 | endloc.add(opt2,0); |
|---|
| 63 | // Show the first (empty) option |
|---|
| 64 | startloc.selectedIndex = "0"; |
|---|
| 65 | endloc.selectedIndex = "0"; |
|---|
| 66 | } |
|---|
| 67 | </script> |
|---|
| 68 | |
|---|
| 69 | <div id="main" role="main" class="mainflex"> |
|---|
| 70 | <div id="pageTitle" class="header">Request Emergency Closure</div> |
|---|
| 71 | |
|---|
| 72 | <div class="searchform"> |
|---|
| 73 | {{=form}} |
|---|
| 74 | </div> |
|---|
| 75 | </div> |
|---|