darkfreaks Posted February 23, 2009 Share Posted February 23, 2009 okay so i have a validate function in Javascript and it stops working after the first 2 if statements and i cant figure out why ??? function validForm(WorkOrderNew) { if (document.WorkOrderNew.Location.selectedIndex === 0) { alert("You must enter a Location"); WorkOrderNew.Location.focus(); return false; } if (WorkOrderNew.WorkOrderName.value === "") { alert("You must enter a Work Order Name"); WorkOrderNew.WorkOrderName.focus(); return false; } //does not work after this point if (WorkOrderNew.Customer.value === "") { alert("You must enter a Customer Name"); WorkOrderNew.Customer.focus(); return false; } if (document.WorkOrderNew.StartMonth.selectedIndex === 0) { alert("You MUST enter the Start Month"); WorkOrderNew.StartMonth.focus(); return false; } if (document.WorkOrderNew.StartDay.selectedIndex === 0) { alert("You MUST enter the Start Day"); WorkOrderNew.StartDay.focus(); return false; } if (document.WorkOrderNew.StartYear.selectedIndex === 0) { alert("You MUST enter the Start Year"); WorkOrderNew.StartYear.focus(); return false; } if (document.WorkOrderNew.EndMonth.selectedIndex === 0) { alert("You MUST enter the End Month"); WorkOrderNew.EndMonth.focus(); return false; } if (document.WorkOrderNew.EndDay.selectedIndex === 0) { alert("You MUST enter the End Day"); WorkOrderNew.EndDay.focus(); return false; } if (document.WorkOrderNew.EndYear.selectedIndex === 0) { alert("You MUST enter the End Year"); WorkOrderNew.EndYear.focus(); return false; } if (WorkOrderNew.PackageType.selectedIndex === 0) { alert("You must Select a Package Type"); WorkOrderNew.PackageType.focus(); return false; } if (WorkOrderNew.Description.value === "") { alert("You must enter a Message Body"); WorkOrderNew.Description.focus(); WorkOrderNew.Description.select(); return false; } if (WorkOrderNew.Phone.value === "") { alert("You must enter a Phone"); WorkOrderNew.Phone.focus(); WorkOrderNew.Phone.select(); return false; } if (WorkOrderNew.City.value === "") { alert("You must enter a City"); WorkOrderNew.City.focus(); WorkOrderNew.City.select(); return false; } if (WorkOrderNew.State.selectedIndex === 0) { alert("You must enter a State"); WorkOrderNew.State.focus(); return false; } if (WorkOrderNew.Zip.value === "") { alert("You must enter a Zip"); WorkOrderNew.Zip.focus(); WorkOrderNew.Zip.select(); return false; } if (WorkOrderNew.URL.value === "") { alert("You must enter a URL link"); WorkOrderNew.URL.focus(); WorkOrderNew.URL.select(); return false; } return true; } Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 24, 2009 Author Share Posted February 24, 2009 nevermind decided to use jquery instead Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.