View Full Version : How to prevent auto redirect of drop down menu?

09-25-2007, 02:32 PM
Hi..guys!I have a drop down menu with javascript null validation.However,instead of clicking submit button,it will immediately auto redirect after option was selected.Is it possible to prevent this kind of fast respond?

<select name="rNumber" title="number of ticket"
<option selected>Select</option>

<script language="JavaScript" type="text/JavaScript">
function validate(which) {
var selects = which.getElementsByTagName('select');
var radios = which.getElementsByTagName('input');
for(sel = 0; sel < selects.length; sel++) {
if(selects[sel].options[selects[sel].selectedIndex].text == 'Select') {
alert('Please select number of ticket!');
return false;

var rselCount = 0;
for(radio = 0; radio < radios.length; radio++) {
if(radios[radio].checked) {

if(rselCount == 0) {
alert('Please select screening time!');
return false;
return true;

function GoToNextPage(value){
if(value != ""){
document.location = 'reservation3.php?selected_no_ticket=' + value;

<form action="reservation3.php" method="post" name="movieList"
onSubmit="return validate(this);">

And also when onchange mixed with onsubmit,the validation can't execute
alert('Please select screening time!'); when radio button was not selected.What went wrong in the script?Thanks...

09-25-2007, 08:59 PM
At the very least, you need to get rid of this: