June 16, 201115 yr Hi, I am a total noob when it comes to Javascript (and server-side languages). I am trying to add some fields to a form that is then validated by Javascript. The form to email script is done in php. The problem is whenever I try to add code to the below script, such as: && isPostcode() the form fails and just calls the sendquote.php script. Can anyone offer any reasons as to why this is? I am unsure is it is a problem with the Javascript or the php script... Any help would be greatly appreciated. For reference the link is here: http://banquetinghire.co.uk/ordersystem/quotation-form.htm (I didn't design the site!) Sam function checkAvailibility() { // re-calculate... calculate (); if ( isName() && isAddress1() && isTown() && isCounty() && isTel() && isYourEmail() && isFuncDate() && isFuncAdd1() && isFuncTown() && somethingToQuoteFor() && isYourEmailValid() ) { document.ordersummary.emailQuote.value = "No"; setValue(); return true; } else { return false; } } function isName() { if (document.ordersummary.Name.value=="") { alert ("\n Please Enter Your Name") document.ordersummary.Name.focus(); return false; } return true; } function isAddress1() { if (document.ordersummary.Address1.value=="") { alert ("\n Please Enter Your Address") document.ordersummary.Address1.focus(); return false; } return true; } function isTown() { if (document.ordersummary.Town.value=="") { alert ("\n Please Enter Your Town") document.ordersummary.Town.focus(); return false; } return true; } function isCounty() { if (document.ordersummary.County.value=="") { alert ("\n Please Enter Your County") document.ordersummary.County.focus(); return false; } return true; } //function isPostcode() { if (document.ordersummary.Postcode.value=="") { alert ("\n Please Enter Your Postcode") //document.ordersummary.Postcode.focus(); return false; } return true; } function isTel() { if (document.ordersummary.Tel.value=="") { alert ("\n Please Enter Your Telephone Number") document.ordersummary.Tel.focus(); return false; } return true; } function isYourEmail() { if (document.ordersummary.YourEmail.value=="") { alert ("\n Please Enter Your Email") document.ordersummary.YourEmail.focus(); return false; } return true; } function isFuncDate() { if (document.ordersummary.FuncDate.value=="") { alert ("\n Please Enter Your Function Date") document.ordersummary.FuncDate.focus(); return false; } return true; } function isFuncAdd1() { if (document.ordersummary.FuncAdd1.value=="") { alert ("\n Please Enter Your Function Address") document.ordersummary.FuncAdd1.focus(); return false; } return true; } function isFuncTown() { if (document.ordersummary.FuncTown.value=="") { alert ("\n Please Enter Your Function Town") document.ordersummary.FuncTown.focus(); return false; } return true; } //function isFuncPostcode() { if (document.ordersummary.FuncPostcode.value=="") { alert ("\n Please Enter Your Function Postcode") //document.ordersummary.FuncPostcode.focus(); return false; } return true; } function isemailonly() { if (document.ordersummary.emailonly.value=="") { alert ("\n Please Enter Your Email Address") document.ordersummary.emailonly.focus(); return false; } return true; }
Create an account or sign in to comment