Skip to main content
Updated answer
Source Link
harshal gite
  • 1.5k
  • 1
  • 13
  • 24
<div>Urgency</div>
<select id="urgencyMenu">
  <option selected="selected">Show All</option>
  <option>High</option>
  <option>Low</option>
</select>
<div>Impact</div>
<select id="impactMenu">
    <option selected="selected">Show All</option>
    <option>Site/Dept</option>
    <option>Multiple Users</option>
</select>
<br>
<div id="platformMenu">
    <div>Platform</div> 
    <input id="platform" checked type="checkbox" name="platform" value="Unix">Unix
    <input id="platform" checked type="checkbox" name="platform" value="Windows">Windows
    <input id="platform" checked type="checkbox" name="platform" value="Network">Network<br><br>
</div>
<input type="button" onsubmit="SubmitClicked()" id="go" value="Submit">


<script>
//function called when submit button is clicked
function SubmitClicked(){
    var urgencyElement = document.getElementById("urgencyMenu");
    var impactElement = document.getElementById("impactMenu");    

    var selectedUrgency = urgencyElement.options[urgencyElement.selectedIndex];

    var selectedImpact = impactElement.options[impactElement.selectedIndex];

    var platformElementChoices = document.querySelectorAll("#platformMenu input[type='checkbox']:checked");

    //function to check checkbox values = unix & windows (this function can be dynamic with some modifications)
    function checkPlatform(platformElementChoices){
        var vw = true;
        for(var i=0;i < platformElementChoices.length; i++){
            var currCheckbox = platformElementChoices[i];
            if(currCheckbox.value != "Network"){
                vw = true;
            }
            else{
                vw = false;
                break;
            }
        }            
        return vw;
    }

    if(selectedUrgency.value == "High" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location.href = URL1; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Low" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location.href = URL2; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Site/Dept" && platformElementChoices.length == 3){
        window.location.href = URL3; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Multiple Users" && platformElementChoices.length == 3){
        window.location.href = URL4; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Show All" && checkPlatform(platformElementChoices)){
        window.location.href = URL4; //enter url as string between 2 quotes
    }
    else{
        window.location.href = homepageURL;
    }

}
</script>
<div>Urgency</div>
<select id="urgencyMenu">
  <option selected="selected">Show All</option>
  <option>High</option>
  <option>Low</option>
</select>
<div>Impact</div>
<select id="impactMenu">
    <option selected="selected">Show All</option>
    <option>Site/Dept</option>
    <option>Multiple Users</option>
</select>
<br>
<div id="platformMenu">
    <div>Platform</div> 
    <input id="platform" checked type="checkbox" name="platform" value="Unix">Unix
    <input id="platform" checked type="checkbox" name="platform" value="Windows">Windows
    <input id="platform" checked type="checkbox" name="platform" value="Network">Network<br><br>
</div>
<input type="button" onsubmit="SubmitClicked()" id="go" value="Submit">


<script>
//function called when submit button is clicked
function SubmitClicked(){
    var urgencyElement = document.getElementById("urgencyMenu");
    var impactElement = document.getElementById("impactMenu");    

    var selectedUrgency = urgencyElement.options[urgencyElement.selectedIndex];

    var selectedImpact = impactElement.options[impactElement.selectedIndex];

    var platformElementChoices = document.querySelectorAll("#platformMenu input[type='checkbox']:checked");

    //function to check checkbox values = unix & windows (this function can be dynamic with some modifications)
    function checkPlatform(platformElementChoices){
        var vw = true;
        for(var i=0;i < platformElementChoices.length; i++){
            var currCheckbox = platformElementChoices[i];
            if(currCheckbox.value != "Network"){
                vw = true;
            }
            else{
                vw = false;
                break;
            }
        }            
        return vw;
    }

    if(selectedUrgency.value == "High" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location = URL1; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Low" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location = URL2; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Site/Dept" && platformElementChoices.length == 3){
        window.location = URL3; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Multiple Users" && platformElementChoices.length == 3){
        window.location = URL4; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Show All" && checkPlatform(platformElementChoices)){
        window.location = URL4; //enter url as string between 2 quotes
    }
    else{
        window.location = homepageURL;
    }

}
</script>
<div>Urgency</div>
<select id="urgencyMenu">
  <option selected="selected">Show All</option>
  <option>High</option>
  <option>Low</option>
</select>
<div>Impact</div>
<select id="impactMenu">
    <option selected="selected">Show All</option>
    <option>Site/Dept</option>
    <option>Multiple Users</option>
</select>
<br>
<div id="platformMenu">
    <div>Platform</div> 
    <input id="platform" checked type="checkbox" name="platform" value="Unix">Unix
    <input id="platform" checked type="checkbox" name="platform" value="Windows">Windows
    <input id="platform" checked type="checkbox" name="platform" value="Network">Network<br><br>
</div>
<input type="button" onsubmit="SubmitClicked()" id="go" value="Submit">


<script>
//function called when submit button is clicked
function SubmitClicked(){
    var urgencyElement = document.getElementById("urgencyMenu");
    var impactElement = document.getElementById("impactMenu");    

    var selectedUrgency = urgencyElement.options[urgencyElement.selectedIndex];

    var selectedImpact = impactElement.options[impactElement.selectedIndex];

    var platformElementChoices = document.querySelectorAll("#platformMenu input[type='checkbox']:checked");

    //function to check checkbox values = unix & windows (this function can be dynamic with some modifications)
    function checkPlatform(platformElementChoices){
        var vw = true;
        for(var i=0;i < platformElementChoices.length; i++){
            var currCheckbox = platformElementChoices[i];
            if(currCheckbox.value != "Network"){
                vw = true;
            }
            else{
                vw = false;
                break;
            }
        }            
        return vw;
    }

    if(selectedUrgency.value == "High" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location.href = URL1; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Low" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location.href = URL2; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Site/Dept" && platformElementChoices.length == 3){
        window.location.href = URL3; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Multiple Users" && platformElementChoices.length == 3){
        window.location.href = URL4; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Show All" && checkPlatform(platformElementChoices)){
        window.location.href = URL4; //enter url as string between 2 quotes
    }
    else{
        window.location.href = homepageURL;
    }

}
</script>
Source Link
harshal gite
  • 1.5k
  • 1
  • 13
  • 24

Try the code below. Let me know if you need any help.

<div>Urgency</div>
<select id="urgencyMenu">
  <option selected="selected">Show All</option>
  <option>High</option>
  <option>Low</option>
</select>
<div>Impact</div>
<select id="impactMenu">
    <option selected="selected">Show All</option>
    <option>Site/Dept</option>
    <option>Multiple Users</option>
</select>
<br>
<div id="platformMenu">
    <div>Platform</div> 
    <input id="platform" checked type="checkbox" name="platform" value="Unix">Unix
    <input id="platform" checked type="checkbox" name="platform" value="Windows">Windows
    <input id="platform" checked type="checkbox" name="platform" value="Network">Network<br><br>
</div>
<input type="button" onsubmit="SubmitClicked()" id="go" value="Submit">


<script>
//function called when submit button is clicked
function SubmitClicked(){
    var urgencyElement = document.getElementById("urgencyMenu");
    var impactElement = document.getElementById("impactMenu");    

    var selectedUrgency = urgencyElement.options[urgencyElement.selectedIndex];

    var selectedImpact = impactElement.options[impactElement.selectedIndex];

    var platformElementChoices = document.querySelectorAll("#platformMenu input[type='checkbox']:checked");

    //function to check checkbox values = unix & windows (this function can be dynamic with some modifications)
    function checkPlatform(platformElementChoices){
        var vw = true;
        for(var i=0;i < platformElementChoices.length; i++){
            var currCheckbox = platformElementChoices[i];
            if(currCheckbox.value != "Network"){
                vw = true;
            }
            else{
                vw = false;
                break;
            }
        }            
        return vw;
    }

    if(selectedUrgency.value == "High" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location = URL1; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Low" && selectedImpact.value == "Show All" && platformElementChoices.length == 3){
        window.location = URL2; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Site/Dept" && platformElementChoices.length == 3){
        window.location = URL3; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Multiple Users" && platformElementChoices.length == 3){
        window.location = URL4; //enter url as string between 2 quotes
    }
    else if(selectedUrgency.value == "Show All" && selectedImpact.value == "Show All" && checkPlatform(platformElementChoices)){
        window.location = URL4; //enter url as string between 2 quotes
    }
    else{
        window.location = homepageURL;
    }

}
</script>