antonyx6666
Programmer
Hello, I have a drop down list on my form called DDPaddrType - let's call it Drop Down 1
Drop Down 1 - DDPaddrType
Another <option> is added to this drop down list from a file called AddrShortcuts.js.inc. This extra <option> appears in the drop down list above as 'Heathrow Airport.' Below is the code in AddrShortcuts.js.inc which adds this <option>
AddrShortcuts.js.inc
I have another drop down list on the same form called DDvehAttr
Drop Down 2 - DDvehAttr
This drop down is populated from another file called global.inc.
What I am trying to do is change the values of Drop Down 2 based on the value of Drop Down 1. Drop Down 1 has an onchange event called DDPaddrTypeChanged
DDPaddrTypeChanged
Is there a way to add a feature to the function above, in pseudo code i would want to achieve the following:
CONCLUSION
It has taken me 1 hour to prepare this post. I am very serious about getting this done ASAP. If nobody can see an obvious solution (code example for me to test) then can somebody PLEASE help me understand the logic of how this was built (off the shelf product) and how I can acheive this feature. If you need any additional code I CAN SUPPLY IT
Thanks
Drop Down 1 - DDPaddrType
Code:
<select id="DDPaddrType" class="FormField" style="display:none;width:150px;" onChange="DDPaddrTypeChanged(this)" >
<option>Please Select . . .</option>
<option>Local Address</option>
</select>
Another <option> is added to this drop down list from a file called AddrShortcuts.js.inc. This extra <option> appears in the drop down list above as 'Heathrow Airport.' Below is the code in AddrShortcuts.js.inc which adds this <option>
AddrShortcuts.js.inc
Code:
// Place holder
var AS_Airport =
{
group :
"Heathrow Airport",
premise:
"Flight Number (eg VS401 Dubai)",
shortcuts :
[
["HEATHROW TERMINAL 1", "Heathrow Airport - Terminal 1"],
["HEATHROW TERMINAL 3", "Heathrow Airport - Terminal 3"],
["HEATHROW TERMINAL 4", "Heathrow Airport - Terminal 4"],
["HEATHROW TERMINAL 5", "Heathrow Airport - Terminal 5"]
]
};
var AddressShortcuts = [AS_Airport];
I have another drop down list on the same form called DDvehAttr
Drop Down 2 - DDvehAttr
Code:
<select id="DDvehAttr" class="FormField" onchange="DDvehAttrChanged(this)" >
<option value="-2">Please Select . . .</option>
<%
for (i=0; i < vehAttr.length; i++)
{%>
<option value="<% = i %>"><% = vehAttr[i] %></option>
<%}
%>
</select>
This drop down is populated from another file called global.inc.
Code:
Session("ListAttributes") = [
["Standard Saloon", ["01. Saloon [SAL]"]],
["Executive Saloon", ["07. Executive Saloon [EXEC-SAL]"]],
["Estate Vehicle", ["02. Estate [EST]"]],
["People Carrier", ["03. 5 Seater [5ST]"]],
["8 Seater Vehicle", ["06. 8 Seater [8ST]"]],
];
What I am trying to do is change the values of Drop Down 2 based on the value of Drop Down 1. Drop Down 1 has an onchange event called DDPaddrTypeChanged
DDPaddrTypeChanged
Code:
function DDPaddrTypeChanged(control)
{
DDPaddrTypeIndex = control.selectedIndex;
if (HandlePickup) HandlePickup.destruct();
HandlePickup = null;
Validate(1, false);
$("PAinput").hide();
$("PAshow").innerHTML = "";
defPickupIndex = -1;
SetPaddrType(true);
}
Is there a way to add a feature to the function above, in pseudo code i would want to achieve the following:
Code:
IF Drop Down 1 value = "Heathrow Airport" THEN
Drop Down 2 values are:
["Standard Saloon", [ "01. Saloon [SAL]", "30. Meet & Greet [M&G]" ]],
["Executive Saloon", [ "07. Executive Saloon [EXEC-SAL]", "30. Meet & Greet [M&G]" ]],
["Estate Vehicle", [ "02. Estate [EST]", "30. Meet & Greet [M&G]" ]],
["People Carrier", [ "03. 5 Seater [5ST]", "30. Meet & Greet [M&G]" ]],
["8 Seater Vehicle", [ "06. 8 Seater [8ST]", "30. Meet & Greet [M&G]" ]]
ELSE
Drop Down 2 values are:
["Standard Saloon", ["01. Saloon [SAL]"]],
["Executive Saloon", ["07. Executive Saloon [EXEC-SAL]"]],
["Estate Vehicle", ["02. Estate [EST]"]],
["People Carrier", ["03. 5 Seater [5ST]"]],
["8 Seater Vehicle", ["06. 8 Seater [8ST]"]],
END IF
CONCLUSION
It has taken me 1 hour to prepare this post. I am very serious about getting this done ASAP. If nobody can see an obvious solution (code example for me to test) then can somebody PLEASE help me understand the logic of how this was built (off the shelf product) and how I can acheive this feature. If you need any additional code I CAN SUPPLY IT
Thanks