function verifyEmail(form) { checkEmail = form.email.value if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) { alert("You have entered an invalid email address. Please try again."); form.email.select(); return false; } else { form.method="get"; form.target="_self"; form.action="myscript.cgi"; form.submit(); } }//function function validate(form_id,email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var address = document.forms[form_id].elements[email].value; if(reg.test(address) == false) { alert('Invalid Email Address'); return false; } }//function function SubmitCheckForm() { frmCheckform = document.Checkform; // assigh the name of the checkbox; var chks = document.getElementsByName('add_checkbox[]'); var hasChecked = false; // Get the checkbox array length and iterate it to see if any of them is selected for (var i = 0; i < chks.length; i++) { if (chks[i].checked) { hasChecked = true; break; } } // if ishasChecked is false then throw the error message if (!hasChecked) { alert("Please select at least one language."); chks[0].focus(); return false; } // if one or more checkbox value is selected then submit the form booSubmit = confirm("Are you sure to add this language list(s)?"); if(booSubmit == true) frmCheckform.submit(); }//function function check() { var a=document.some_form['graduate[]']; alert("Length:"+a.length); var p=0; for(i=0;i 0 && isNaN(textBox.value)) { textBox.value = textBox.value.substring(0, textBox.value.length - 1) } textBox.value = trim(textBox.value); /* if (textBox.value.length == 0) { textBox.value = 0; } else { textBox.value = parseInt(textBox.value); }*/ } /* Check if a form element is empty. If it is display an alert box and focus on the element */ function isEmpty(formElement, message) { formElement.value = trim(formElement.value); _isEmpty = false; if (formElement.value == '') { _isEmpty = true; alert(message); formElement.focus(); } return _isEmpty; } /* Set one value in combo box as the selected value */ function setSelect(listElement, listValue) { for (i=0; i < listElement.options.length; i++) { if (listElement.options[i].value == listValue) { listElement.selectedIndex = i; } } } function setPaymentInfo(isChecked) { with (window.document.frmCheckout) { if (isChecked) { txtPaymentFirstName.value = txtShippingFirstName.value; txtPaymentLastName.value = txtShippingLastName.value; txtPaymentAddress1.value = txtShippingAddress1.value; txtPaymentAddress2.value = txtShippingAddress2.value; txtPaymentPhone.value = txtShippingPhone.value; txtPaymentState.value = txtShippingState.value; txtPaymentCity.value = txtShippingCity.value; txtPaymentPostalCode.value = txtShippingPostalCode.value; txtPaymentCountry.value = txtShippingCountry.value; txtPaymentFirstName.readOnly = true; txtPaymentLastName.readOnly = true; txtPaymentAddress1.readOnly = true; txtPaymentAddress2.readOnly = true; txtPaymentPhone.readOnly = true; txtPaymentState.readOnly = true; txtPaymentCity.readOnly = true; txtPaymentPostalCode.readOnly = true; txtPaymentCountry.readOnly = true; } else { txtPaymentFirstName.readOnly = false; txtPaymentLastName.readOnly = false; txtPaymentAddress1.readOnly = false; txtPaymentAddress2.readOnly = false; txtPaymentPhone.readOnly = false; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; txtPaymentCountry.readOnly = false; } } } function setPaymentInfo1(isChecked) { with (window.document.frmCheckout) { if (isChecked) { txtShippingFirstName.value = txtFirstName.value; txtShippingLastName.value = txtLastName.value; txtShippingAddress1.value = txtAddress1.value; txtShippingAddress2.value = txtAddress2.value; txtShippingPhone.value = txtPhone.value; txtShippingState.value = txtState.value; txtShippingCity.value = txtCity.value; txtShippingPostalCode.value = txtPostalCode.value; txtShippingCountry.value = txtCountry.value; txtShippingFirstName.readOnly = true; txtShippingLastName.readOnly = true; txtShippingAddress1.readOnly = true; txtShippingAddress2.readOnly = true; txtShippingPhone.readOnly = true; txtShippingState.readOnly = true; txtShippingCity.readOnly = true; txtShippingPostalCode.readOnly = true; txtShippingCountry.readOnly = true; } else { txtShippingFirstName.readOnly = false; txtShippingLastName.readOnly = false; txtShippingAddress1.readOnly = false; txtShippingAddress2.readOnly = false; txtShippingPhone.readOnly = false; txtShippingState.readOnly = false; txtShippingCity.readOnly = false; txtShippingPostalCode.readOnly = false; txtShippingCountry.readOnly = false; } } } function unlockPay() { window.document.frmCheckout.chkSame.checked = false; with (window.document.frmCheckout) { txtPaymentFirstName.readOnly = false; txtPaymentLastName.readOnly = false; txtPaymentAddress1.readOnly = false; txtPaymentAddress2.readOnly = false; txtPaymentPhone.readOnly = false; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; txtPaymentCountry.readOnly = false; } }//function function checkShippingAndPaymentInfo() { if(document.frmCheckout.txtUsername) { if (isEmpty(document.frmCheckout.txtUsername, 'Enter Username')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPasswd) { if (isEmpty(window.document.frmCheckout.txtPasswd, 'Enter Password')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtEmail) { if (isEmpty(window.document.frmCheckout.txtEmail, 'Enter Email')) { unlockPay(); return false; } else { isEmail = email_validate(window.document.frmCheckout.txtEmail.value); if(!isEmail) { alert("Invalid Email-id"); window.document.frmCheckout.txtEmail.focus(); unlockPay(); return false; }//if }//else }//else if(window.document.frmCheckout.txtConfirmEmail) { if (isEmpty(window.document.frmCheckout.txtConfirmEmail, 'Enter Confirm Email')) { unlockPay(); return false; } else { isEmail = email_validate(window.document.frmCheckout.txtConfirmEmail.value); if(!isEmail) { alert("Invalid Email-id"); window.document.frmCheckout.txtConfirmEmail.focus(); unlockPay(); return false; }//if }//else if (window.document.frmCheckout.txtConfirmEmail.value != window.document.frmCheckout.txtEmail.value) { alert("Email and Confirm Email-id should be same"); window.document.frmCheckout.txtEmail.focus(); unlockPay(); return false; }//if }//if if(window.document.frmCheckout.txtShippingFirstName) { if (isEmpty(window.document.frmCheckout.txtShippingFirstName, 'Enter first name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingLastName) { if (isEmpty(window.document.frmCheckout.txtShippingLastName, 'Enter last name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingAddress1) { if (isEmpty(window.document.frmCheckout.txtShippingAddress1, 'Enter shipping address')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingPhone) { if (isEmpty(window.document.frmCheckout.txtShippingPhone, 'Enter phone number')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingState) { if (isEmpty(window.document.frmCheckout.txtShippingState, 'Enter shipping address state')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingCity) { if (isEmpty(window.document.frmCheckout.txtShippingCity, 'Enter shipping address city')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtShippingPostalCode) { if (isEmpty(window.document.frmCheckout.txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentFirstName) { if (isEmpty(window.document.frmCheckout.txtPaymentFirstName, 'Enter first name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentLastName) { if (isEmpty(window.document.frmCheckout.txtPaymentLastName, 'Enter last name')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentAddress1) { if (isEmpty(window.document.frmCheckout.txtPaymentAddress1, 'Enter Payment address')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentPhone) { if (isEmpty(window.document.frmCheckout.txtPaymentPhone, 'Enter phone number')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentState) { if (isEmpty(window.document.frmCheckout.txtPaymentState, 'Enter Payment address state')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentCity) { if (isEmpty(window.document.frmCheckout.txtPaymentCity, 'Enter Payment address city')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtPaymentPostalCode) { if (isEmpty(window.document.frmCheckout.txtPaymentPostalCode, 'Enter the Payment address postal/zip code')) { unlockPay(); return false; } }//if if(window.document.frmCheckout.txtTermsAgreed) { if (!window.document.frmCheckout.txtTermsAgreed.checked) { alert("Please Accept Terms & Conditions"); window.document.frmCheckout.txtTermsAgreed.focus(); //unlockPay(); return false; } }//if return true; }//function function isValidGrantForm(form1) { if(form1.name.value == "") { alert("Please enter name "); form1.name.focus(); return false; }//if if(form1.email.value == "") { alert("Please enter email "); form1.email.focus(); return false; }//if if(form1.email.value != "") { isEmail = email_validate(form1.email.value); if(!isEmail) { alert("Invalid Email-id"); form1.email.focus(); return false; }//if }//if if(form1.phone.value == "") { alert("Please enter phoneno "); form1.phone.focus(); return false; }//if return true; }//function