I'm looking at JS again, I keep getting the error

Uncaught SyntaxError: Illegal return statement

<script type="text/javascript">

var first = document.myform.firstSelect.options[document.myform.firstSelect.selectedIndex].innerText
var second= document.myform.secondSelect.options[document.myform.secondSelect.selectedIndex].innerText
var third= document.myform.thirdSelect.options[document.myform.thirdSelect.selectedIndex].innerText
var fourth= document.myform.fourthSelect.options[document.myform.fourthSelect.selectedIndex].innerText

if(validate_required(first, "Please select an artist")==false)
	{
		return false;
	}

 else if(validate_required(second, "Please selcet a venu")==false)
	{
		return false;
	}

else if(validate_required(third, "Please select an artist")==false)
	{
		return false;
	}
else if(validate_required(fourth, "Please select an artist")==false)
	{
		return false;
	}
return true;
}



function managefirstSelect(value)
{
    var firstSelect = document.myform.firstSelect
    var secondSelect = document.myform.secondSelect
    var thirdSelect = document.myform.thirdSelect
    var fourthSelect = document.myform.fourthSelect
    var fifthSelect = document.myform.fourthSelect
    secondSelect.options.length = 0
    thirdSelect.options.length = 0

if(value == "Madonna")
{
    secondSelect.options[secondSelect.options.length] = new Option('Please select a venu :')
    secondSelect.options[secondSelect.options.length] = new Option('London')
    secondSelect.options[secondSelect.options.length] = new Option('Manchester')

}
if(value == "Rod Stewart")
{
    secondSelect.options[secondSelect.options.length] = new Option('Please select a venu :')
    secondSelect.options[secondSelect.options.length] = new Option('London')
    secondSelect.options[secondSelect.options.length] = new Option('Manchester')
    secondSelect.options[secondSelect.options.length] = new Option('Glasgow')

}
if(value == "Beyonce")
{
    secondSelect.options[secondSelect.options.length] = new Option('Please select a venu :')
    secondSelect.options[secondSelect.options.length] = new Option('Glasgow')
    secondSelect.options[secondSelect.options.length] = new Option('Manchester')
    secondSelect.options[secondSelect.options.length] = new Option('Birmingham')
    secondSelect.options[secondSelect.options.length] = new Option('London')
}
else if(value == "Guns and Roses")
{
    secondSelect.options[secondSelect.options.length] = new Option('Please select a venu :')
    secondSelect.options[secondSelect.options.length] = new Option('London')



}
if(value == "Oasis")
{
    secondSelect.options[secondSelect.options.length] = new Option('Please select a venu :')
    secondSelect.options[secondSelect.options.length] = new Option('London')
    secondSelect.options[secondSelect.options.length] = new Option('Glasgow')
    secondSelect.options[secondSelect.options.length] = new Option('Nottingham')

}    
}

function managesecondSelect(value)
{
    var secondSelect = document.myform.secondSelect
    var thirdSelect = document.myform.thirdSelect
    var fourthSelect = document.myform.fourthSelect
	var fifthSelect = document.myform.fifthSelect
    var artist = document.myform.firstSelect.options[document.myform.firstSelect.selectedIndex].innerText

if(artist == "Madonna" && value == "London")
{
    thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date:')
    thirdSelect.options[thirdSelect.options.length] = new Option('17th of July')
    thirdSelect.options[thirdSelect.options.length] = new Option('18th of July')
    fourthSelect.options[fourthSelect.options.length] = new Option('£30')
	fourthSelect.options[fourthSelect.options.length] = new Option('£45')
	fourthSelect.options[fourthSelect.options.length] = new Option('£70')
	fifthSelect.options[fifthSelect.options.length] = new Option('1')
	fifthSelect.options[fifthSelect.options.length] = new Option('2')
	fifthSelect.options[fifthSelect.options.length] = new Option('3')
	fifthSelect.options[fifthSelect.options.length] = new Option('4')
	fifthSelect.options[fifthSelect.options.length] = new Option('5')
	fifthSelect.options[fifthSelect.options.length] = new Option('6')
}
else if(artist == "Madonna" && value == "Manchester")
{
    thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date :')
    thirdSelect.options[thirdSelect.options.length] = new Option('21st of July')
    fourthSelect.options[fourthSelect.options.length] = new Option('£25')
    fourthSelect.options[fourthSelect.options.length] = new Option('£35')
	fourthSelect.options[fourthSelect.options.length] = new Option('£45')
	fourthSelect.options[fourthSelect.options.length] = new Option('£70')
	fifthSelect.options[fifthSelect.options.length] = new Option('1')
	fifthSelect.options[fifthSelect.options.length] = new Option('2')
	fifthSelect.options[fifthSelect.options.length] = new Option('3')
	fifthSelect.options[fifthSelect.options.length] = new Option('4')
	fifthSelect.options[fifthSelect.options.length] = new Option('5')
	fifthSelect.options[fifthSelect.options.length] = new Option('6')
}
   if(artist == "Rod Stewart" && value == "London")
    {
        thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date:')
        thirdSelect.options[thirdSelect.options.length] = new Option('13th of July')
        thirdSelect.options[thirdSelect.options.length] = new Option('15th of July')
		fourthSelect.options[fourthSelect.options.length] = new Option('£35')
        fourthSelect.options[fourthSelect.options.length] = new Option('£50')
		fourthSelect.options[fourthSelect.options.length] = new Option('£60')
		fifthSelect.options[fifthSelect.options.length] = new Option('1')
		fifthSelect.options[fifthSelect.options.length] = new Option('2')
		fifthSelect.options[fifthSelect.options.length] = new Option('3')
		fifthSelect.options[fifthSelect.options.length] = new Option('4')
		fifthSelect.options[fifthSelect.options.length] = new Option('5')
		fifthSelect.options[fifthSelect.options.length] = new Option('6')

}
else if(artist == "Rod Stewart" && value == "Manchester")
{
    thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date :')
    thirdSelect.options[thirdSelect.options.length] = new Option('18th of July')
	thirdSelect.options[thirdSelect.options.length] = new Option('20th of July')
	fourthSelect.options[fourthSelect.options.length] = new Option('£35')
    fourthSelect.options[fourthSelect.options.length] = new Option('£50')
	fourthSelect.options[fourthSelect.options.length] = new Option('£60')
	fifthSelect.options[fifthSelect.options.length] = new Option('1')
	fifthSelect.options[fifthSelect.options.length] = new Option('2')
	fifthSelect.options[fifthSelect.options.length] = new Option('3')
	fifthSelect.options[fifthSelect.options.length] = new Option('4')
	fifthSelect.options[fifthSelect.options.length] = new Option('5')
	fifthSelect.options[fifthSelect.options.length] = new Option('6')


}
else if(artist == "Rod Stewart" && value == "Glasgow")
{
    thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date :')
    thirdSelect.options[thirdSelect.options.length] = new Option('22nd of July')
	thirdSelect.options[thirdSelect.options.length] = new Option('23rd of July')
	fourthSelect.options[fourthSelect.options.length] = new Option('£35')
    fourthSelect.options[fourthSelect.options.length] = new Option('£50')
	fourthSelect.options[fourthSelect.options.length] = new Option('£60')
	fifthSelect.options[fifthSelect.options.length] = new Option('1')
	fifthSelect.options[fifthSelect.options.length] = new Option('2')
	fifthSelect.options[fifthSelect.options.length] = new Option('3')
	fifthSelect.options[fifthSelect.options.length] = new Option('4')
	fifthSelect.options[fifthSelect.options.length] = new Option('5')
	fifthSelect.options[fifthSelect.options.length] = new Option('6')


}
if(artist == "Guns and Roses" && value == "London")
{
    thirdSelect.options[thirdSelect.options.length] = new Option('Please select a date:')
    thirdSelect.options[thirdSelect.options.length] = new Option('10th of July')
	fourthSelect.options[fourthSelect.options.length] = new Option('£88')
	fifthSelect.options[fifthSelect.options.length] = new Option('1')
	fifthSelect.options[fifthSelect.options.length] = new Option('2')
	fifthSelect.options[fifthSelect.options.length] = new Option('3')
	fifthSelect.options[fifthSelect.options.length] = new Option('4')
	fifthSelect.options[fifthSelect.options.length] = new Option('5')
	fifthSelect.options[fifthSelect.options.length] = new Option('6')

}

}
</script>

    
    <form name="myform" action="" method="post">
    
    <select name="firstSelect"  size="1" onchange="managefirstSelect(document.myform.firstSelect.options[document.myform.firstSelect.selectedIndex].innerText)">
    
      <option value="choose" selected = "selected">Select an artist:</option>
      <option value="madonna">Madonna</option>
      <option value="rod">Rod Stewart</option>
      <option value="Guns and Roses">Guns and Roses</option>
      <option value="Oasis">Oasis</option>
      <option value="Beyonce">Beyonce</option>
    
    </select>
    
    <select name="secondSelect"  size="1" onchange="managesecondSelect(document.myform.secondSelect.options[document.myform.secondSelect.selectedIndex].innerText)">
     <option value="">
             <br>
        Please select a venu:
    </select>
    
    <select name="thirdSelect" size="1">
      <option value="">
             <br>
        Please select a date:
      </option>
    </select>
    
    <select name="fourthSelect" size="1">
      <option value="">
             <br>
        Please select a ticket price:
      </option>
    </select>
    <select name="fifthSelect" size="1">
             <br>
        Please select How many tickets you wish to purchase:
      </option>
    </select>
    <br><br>
    
    <input type="submit" value = "Submit">
    
    </form>
    

      That first block of JS code there doesn't seem to be inside a function.

        Weedpacket;11062589 wrote:

        That first block of JS code there doesn't seem to be inside a function.

        Ah, thanks got it working

          Write a Reply...