JS Validation if dropdown value selected or not <p>I am trying to write a validation block inside my JS to check if the user has selected a value or not and pop up a message if the value is not selected. </p> <pre><code>function validate(form) { var success = true; var message = ""; if (form.dropdown.selectedIndex == 0 ) { form.save.disabled=true; if (0 &lt; message.length) { message += "\n"; } message += "dropdown value should be selected."; } if (0 &lt; message.length) { alert(message); success = false; } return success; } </code></pre> <p>When I click on Save button I call this function. I don't see errors in the logs. Can anyone tell me what am I doing wrongly here? Or can you guide me what is the correct method to validate if the user has selected a value before allowing to save?</p> <p>Thanks!</p>