...

View Full Version : my submit function in form is not calling javascript



finnstones1
03-19-2005, 01:47 AM
please go to :eek:

e
n
glish
trunk
show
co.com/setup_store.cfm

I cannot get my form validation to get fired, check out the javascript and you will see this code which calls my javascript function named editinput which does not work ....whaaaa!!!

<form enctype="multipart/form-data" method="post" name="inputForm" action="testing.cfm" onsubmit="return editInput();">
here is the function but you may want to look at source to find true error

function editInput() {

if (theForm.firstName.value == "") {
alert('You must provide your first name.');


} if ((theForm.checkbox.checked == true) && (theForm.flat.value != "")){
alert('You must choose to use a flat rate for shipping charges or utilize our live billing system.');
return(false);

} if ((theForm.checkbox.checked == false) && (theForm.flat.value == "")){
alert('You must select a shipping charge policy at the bottom of the form');
return(false);

} if ((theForm.state.value != "") && (theForm.otherstate.value != "")) {
alert('You indicated two states.');
theForm.state.focus();
return(false);

} if ((theForm.state.value == "") && (theForm.otherstate.value == "") ){
alert('You must indicate a state.');
theForm.state.focus();
return(false);

} if (theForm.lastName.value == "") {
alert('You must provide your last name.');
theForm.lastName.focus();
return(false);

} if (theForm.address1.value == "") {
alert('You must provide your address.');
theForm.address1.focus();
return(false);

} if (theForm.city.value == "") {
alert('You must provide your city.');
theForm.city.focus();
return(false);

} if (theForm.country.selectedIndex == 0) {
theForm.country.focus();
alert('You must provide your country.');
return(false);

} if ((theForm.country.selectedIndex == 1) && (theForm.state.selectedIndex == 0)) {
alert('Use the drop-down list of states if you are located in the us.');
theForm.state.focus();
return(false);

} if (theForm.country.selectedIndex > 1) {
theForm.state.selectedIndex = 0;
if (theForm.otherState.value.length == 0) {
alert('Please enter your state or province name');
theForm.otherState.focus();
return (false);
}

} if (theForm.zip.value == "") {
alert('You must provide your zip/postal code.');
theForm.zip.focus();
return(false);

} if (theForm.zip.value.length < 5) {
alert('You must provide your zip/postal code.');
theForm.zip.focus();
return(false);


} if (theForm.homePhone.value == "") {
alert('You must provide your home phone number.');
theForm.homePhone.focus();
return(false);

} if (theForm.workPhone.value == "") {
alert('You must provide a phone number for customers to reach you.');
theForm.workPhone.focus();
return(false);

} if (theForm.ccName.value == "") {
alert('You must provide the name in which your credit card is billed.');
theForm.ccName.focus();
return(false);

} if (theForm.ccAddress.value == "") {
alert('You must provide your credit card billing address.');
theForm.ccAddress.focus();
return(false);

} if (theForm.ccCity.value == "") {
alert('You must provide your credit card billing address.');
theForm.ccCity.focus();
return(false);

} if (theForm.ccState.value == "") {
alert('You must provide your credit card billing address.');
theForm.ccState.focus();
return(false);

} if (theForm.ccZip.value == "") {
alert('You must provide your credit card billing address.');
theForm.ccZip.focus();
return(false);

} if (theForm.ccCountry.value == "") {
alert('You must provide your credit card billing address.');
theForm.ccCountry.focus();
return(false);

}

if (CheckcreditCardNumber(theForm) == false) {
return (false);

}

var workfield = theForm.workPhone.value.replace(/[^0-9]]/g,""); // drop nonnumerics from phone #
if (workfield.length < 10) {
alert('Please enter your phone number, including the area code.');
theForm.workPhone.focus();
return (false);

}
workfield = theForm.homePhone.value.replace(/[^0-9]]/g,""); // drop nonnumerics from phone #
if (workfield.length < 10) {
alert('Please enter your phone number, including the area code.');
theForm.workPhone.focus();
return (false);

}

}

</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum