The script below does what I want it to do except you need to change the ixproject field (Probably because my other projects do not uses subcategory) for the dropdowns to be updated with the new values. Is there a way to refresh certain html elements after their values have been changed.
$(document).ready(function(){
var categoryChanged = $('#ixCategory');
var reloadProject = $('#ixProject');
// We don't need Schedule Item so remove it. From our options.
var removeScheduleItem = document.getElementById("ixCategory");
var select = document.getElementById("subcategorya85");
//Remove all options that may exist.
function resetSelectBox(){
var select = document.getElementById("subcategorya85");
select.options.length = 0;
}
//Remove all options before starting.
$(document).ready(function() {
resetSelectBox();
select.options[0] = new Option("--");
//removes schedule item from ixcategory
removeScheduleItem.remove(3);
});
categoryChanged.on("change", function(event){
if (($('#ixCategory')[0].selectedIndex == 0))
{
resetSelectBox();
select.options[0] = new Option("A", "A");
select.options[1] = new Option("B", "B");
select.options[2] = new Option("C", "C");
}
else
if (($('#ixCategory')[0].selectedIndex == 1))
{
resetSelectBox();
select.options[0] = new Option("D", "D");
select.options[1] = new Option("E", "E");
}else
if (($('#ixCategory')[0].selectedIndex == 2))
{
resetSelectBox();
select.options[0] = new Option("F", "F");
}else
if (($('#ixCategory')[0].selectedIndex == 3))
{
resetSelectBox();
select.options[0] = new Option("G", "G");
}
})
});
EDIT: I copied the exact same script to a Fiddle and got the desired result. http://jsfiddle.net/themaniac27/VNfFH/
What do I need to do differently to get this to work in Fogbugz. This was attempted using the fogbugz on demand trial.