It seems i posted this in the incorrect topic, so i am reposting here.
Please excuse the Newbie question. I am not really a programmer so excuse me if i dont clarify my point correctly. I am trying to debug an ex-employee's web code and seem to sinking here. Let me try to explain.
We are receiving few blank submit forms via a handful of clients websites. Ordinarily i would not stress too much as it is less that 5% of the form submits that are failing. However, seeing as we are looking after the clients SEM (search engine marketing) and the clients are getting charged for the submits (in a round about kinda way).I was informed by the miscreant that the blank form submits are due to client machines that do not have java installed or enabled in the browser. Now this does sound plausible to me, but very convenient.
Below is the code i am looking at
Expand|Select|Wrap|Line Numbers
- <script language="javascript" type="text/javascript">
- function Validation(form){
- if (form.name.value == ""){
- alert("Please enter 'First Name'.");
- form.name.focus();
- return false;}
- var email = form.email.value;
- if (email==""){
- alert ("Please enter E-mail Address.");
- form.email.focus();
- return false;}
- if (email.length >0) {
- i=email.indexOf("@")
- j=email.indexOf(".",i)
- k=email.indexOf(",")
- kk=email.indexOf(" ")
- jj=email.lastIndexOf(".")+1
- len=email.length
- if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
- }
- else {
- alert("Please enter an exact email address.\n" +
- email+ " is invalid.");
- return false;
- }
- }
- if (form.daycontactno.value == ""){
- alert("Please enter 'Contact No'.");
- form.daycontactno.focus();
- return false;}
- return true;
- }
- </script>
And the form portion:
Expand|Select|Wrap|Line Numbers
- <p>Fields marked with * are mandatory</p>
- <form action="feedback.asp" method="post" name="form" onsubmit="return Validation(this)">
- <table width="96%" border="0" cellspacing="0" cellpadding="3">
- <tr>
- <td width="43%">First Name(s): *</td>
- <td width="57%"><label>
- <input type="text" name="name" id="name" style="width: 190px;"/>
- </label></td>
- </tr>
- <tr>
- <td>Last Name:</td>
- <td><input type="text" name="lastname" id="lastname" style="width: 190px;"/></td>
- </tr>
- <tr>
- <td>Email address: *</td>
- <td><input type="text" name="email" id="email" style="width: 190px;"/></td>
- </tr>
- <tr>
- <td>Tel: *</td>
- <td><input type="text" name="daycontactno" id="daycontactno" style="width: 190px;"/></td>
- </tr>
- <tr>
- <td>Mobile or other contact number:</td>
- <td><input type="text" name="mobileother" id="mobileother" style="width: 190px;"/></td>
- </tr>
- <tr>
- <td>Query:</td>
- <td><textarea name="query" id="query" style="width: 190px;"></textarea></td>
- </tr>
- <tr>
- <td> </td>
- <td><label>
- <input type="submit" name="submit" id="submit" value="Submit" />
- </label></td>
- </tr>
- </table>
- </form>
TIA
T