Hi, firstly I apologise if the title of this thread isn’t quite accurate. I’m sure you’ve all heard it before but I am a complete newbie to Javascript so again: apologies if this is boring and tiresome to even read, let alone help with!
I have been asked to make some changes to a form that uses Javascript for the form validation. There is a ‘function’ that contains the variables of the various form fields and then further code to raise ‘alerts’ if one of the fields on the form hasn’t been filled in. My problem is that for some reason I am unable to add an extra variable to this code after the field of ‘County’ (this will hopefully make sense when you see the code / link…) and I am stumped as to why. I am able to add variables for all of the other required fields except for ‘Postcode’ after ‘County’. This is the case for both forms. The link is here: http://samdelara.co.uk/previews/banq…ation-form.htm and the code I am trying edit is below. The issues seems to be when I add && isPostcode() to this chunk of code:-
function checkAvailibility()
{
// re-calculate...
calculate ();
if ( isName() && isAddress1() && isTown() && isCounty() && isPostcode() && isTel() && isYourEmail() && isFuncDate() && somethingToQuoteFor() && isYourEmailValid() ) {
document.ordersummary.emailQuote.value = "No";
setValue();
return true;
}
else
{
return false;
}
}
/************* FULL CODE BELOW ******************/
function checkAvailibility()
{
// re-calculate...
calculate ();
if ( isName() && isAddress1() && isTown() && isCounty() && isPostcode() && isTel() && isYourEmail() && isFuncDate() && somethingToQuoteFor() && isYourEmailValid() ) {
document.ordersummary.emailQuote.value = "No";
setValue();
return true;
}
else
{
return false;
}
}
function isName() { if (document.ordersummary.Name.value=="") { alert ("\
Please Enter Your Name")
document.ordersummary.Name.focus(); return false; } return true; }
function isAddress1() { if (document.ordersummary.Address1.value=="") { alert ("\
Please Enter Your Address")
document.ordersummary.Address1.focus(); return false; } return true; }
function isTown() { if (document.ordersummary.Town.value=="") { alert ("\
Please Enter Your Town")
document.ordersummary.Town.focus(); return false; } return true; }
function isCounty() { if (document.ordersummary.County.value=="") { alert ("\
Please Enter Your County")
document.ordersummary.County.focus(); return false; } return true; }
function isTel() { if (document.ordersummary.Tel.value=="") { alert ("\
Please Enter Your Telephone Number")
document.ordersummary.Tel.focus(); return false; } return true; }
function isPostcode() { if (document.ordersummary.Postcode.value=="") { alert ("\
Please Enter Your Postcode")
document.ordersummary.Postcode.focus(); return false; } return true; }
function isYourEmail() { if (document.ordersummary.YourEmail.value=="") { alert ("\
Please Enter Your Email")
document.ordersummary.YourEmail.focus(); return false; } return true; }
function isFuncDate() { if (document.ordersummary.FuncDate.value=="") { alert ("\
Please Enter Your Function Date")
document.ordersummary.FuncDate.focus(); return false; } return true; }
function isemailonly() { if (document.ordersummary.emailonly.value=="") { alert ("\
Please Enter Your Email Address")
document.ordersummary.emailonly.focus(); return false; } return true; }
Any help would be massivley appreciated!!