|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help Debugging Script/Error in Script - Help with submitting form using form.submit ()
Help! I am new to JS and need to submit a form using JS using a "button" VERSUS using submit. Below is the code that I have entered in my contact page. When I click the submit page I get the following error:
Error: Object doesn't support this property or method. I am new to JS and need to get this page completed and I am driving myself crazy! Please HELP ME! ================================== [code] <script language="JavaScript" type="text/javascript"> function checkForm(thisform) { if(form.name.value=='') { alert("Name field is required."); return false; } if(form.phone.value=='') { alert("Phone number is required."); return false; } // Check email address if(form.email.value == "") { alert ("You must include an accurate email address."); email = document.f1.Email.value AtPos = email.indexOf("@") StopPos = email.lastIndexOf(".") Message = "" if (email == "") { Message = "Not a valid Email address" + "\n" } if (AtPos == -1 || StopPos == -1) { Message = "Not a valid email address" } if (StopPos < AtPos) { Message = "Not a valid email address" } if (StopPos - AtPos == 1) { Message = "Not a valid email address" } return Message } if(form.email.value == "") { alert ("You must include an accurate email address."); } if((form.email.value.indexOf ('@',0) == -1 || form.email.value.indexOf ('.',0) == -1) && form.email.value != "") { alert("Please verify that your email address is valid."); } // if all is OK submit the form document.form.submit(); } . . <form action="message.php" method="post" name="form" id="form"> . . . <input name="submit" type="button" id="Submit" onclick="checkForm(this.form)" value="Submit"/> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Need Help Debugging Script/Error in Script - Help with submitting form using form.submit () |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|