Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-19-2005, 01:47 AM   PM User | #1
finnstones1
New to the CF scene

 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
finnstones1 is an unknown quantity at this point
my submit function in form is not calling javascript

please go to

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>

Last edited by finnstones1; 03-19-2005 at 01:58 AM..
finnstones1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:38 PM.


Advertisement
Log in to turn off these ads.