The code below is to validate the email field in my form, if the field left empty the javascript will alert "please fill in your email" and then it'll take you to a blank page that says "false". I don't want that to happen, I want them to re-enter their email after clicking the "OK" on the alterbox. I think it's something to do with my "else return true;" - it's a misplaced.
Thanks again :)
function doContinue( )
{
email=document.quickbooking.email.value;
if (email=="")
{
alert("Please fill in your email");
return false;
}
else if(email.indexOf ('@', 0) == -1 || email.indexOf ('.', 0) == -1)
{
alert("Please fill in your Email in the right format");
return false;
}
xF = document.forms['quickbooking'];
xCountry = getListValue( xF.country );
xETADay = getListValue( xF.ETADay );
xETAMonth = getListValue( xF.ETAMonth );
xETAYear = getListValue( xF.ETAYear );
xETAHour = getListValue( xF.ETAHour );
xETAMinute = getListValue( xF.ETAMinute );
xETA = xETADay + '-' + xMonths[ parseInt( xETAMonth )-1 ] + '-' + xETAYear.substr(0,4) + '-' + xETAHour + '-' + xETAMinute;
xETTDay = getListValue( xF.ETTDay );
xETTMonth = getListValue( xF.ETTMonth );
xETTYear = getListValue( xF.ETTYear );
xETTHour = getListValue( xF.ETTHour );
xETTMinute = getListValue( xF.ETTMinute );
xETT = xETTDay + '-' + xMonths[ parseInt( xETTMonth )-1 ] + '-' + xETTYear.substr(0,4) + '-' + xETTHour + '-' + xETTMinute;
xWizardNumber = xF.wizard_number.value;
xName = xF.surname.value ;
xemail = xF.email.value ;
xParams = '&CTR=' + xCountry +'&Country=' + xCountry + '&ETA=' + xETA + '&ETT=' + xETT+ '&CNAM=' + xName + '&WIZ=' + xWizardNumber+'&SOR=0038780x'+'&email=' + xemail;
//url = 'http://book.rent-at-avis.com/avisonline/ibe.nsf/PrefillX?OpenAgent&ResStep=ReservationStep1&IBEOwner=EU&LNG=GB' + xParams;location.href = url;
url = 'index.php?option=com_content&view=article&id=5&Itemid=22' + xParams;location.href = url;
else return true;
}