Redirect User to specific URL depending of selected dropdown during submit

Solution:1

It is true that document.getElementById() returns only one node and there is a reason for that: in proper html, id’s are unique and each id should only exist on one element. In your case, you need to perform 3 different queries by id:

document.addEventListener('wpcf7mailsent', function (event) {
    const basicItemsSelection = document.getElementById("basicitems").value;
    const wirelessItemsSelection = document.getElementById("wirelessitems").value;
    const bluetoothItemsSelection = document.getElementById("bluetoothitems").value;
    
    if (basicItemsSelection === 'Laptop' || wirelessItemsSelection === 'Chromebook'
        || bluetoothItemsSelection === 'Macbook') {
        window.location = 'some_laptop_url';
    } else if (basicItemsSelection === 'Keyboard' || wirelessItemsSelection === 'Wireless Keyboard'
        || bluetoothItemsSelection === 'Bluetooth Keyboard') {
        window.location = 'some_keyboard_url';
    } else {
        window.location = 'some_other_url';
    }
}, false);

The subsequent if statements reflect my understanding of your problem statement. If it’s not accurate, they should be easy to tweak.

Solution:2

Code for Redirect page Based on the select box while submit the form

<html>
<head>
<title>Redirect page based on select box using javascript</title>
<style>
input, select
{
width: 280px;
margin: 19px;
height: 45 px;
padding: 10px;
}
</style>
</head>
<body>
<form  id=”comment-form1″ name=”contact-form1″  onsubmit=”return mysubmit();”>
<input type=”text”  name=”name” placeholder=”Your Name..” required><br>

<input type=”text”  name=”email” placeholder=”Your Email..”required></br>

<input type=”text”  name=”phone” placeholder=”Your 10 digit Phone..”require pattern=”[0-9]{10}”><br/>
<select  id=”option” class=”chosen” >
<option selected disabled>Select Bank</option>
<option value=”http://demos.sanwebcorner.com/”>Sanwebcorner Demo</option>
<option value=”http://www.sanwebcorner.com/” >Sanwebcorner Main Page</option>
<option value=”http://www.sanwebcorner.com/2018/12/bounce-effect-on-hover-button-using-css-and-html.html” >Single page</option>
</select><br/>
<input name=”submit” type=”submit” value=”Submit” /><br>
</form>

<script>
document.getElementById(‘comment-form1’).addEventListener(‘submit’,(e)=>{
e.preventDefault();
window.location = (document.getElementById(‘option’).value);
})
</script>

</div>
</div>
</section>
</body>
</html>