Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript help

Featured Replies

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; }

post-2631-0-88666800-1308230984_thumb.gif

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.