473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

blank form submits

Hi Guys

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).

Below is the code i am looking at
<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:

<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>&nbsp;</td>
<td><label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label></td>
</tr>
</table>
</form>

Any improvements or suggestion welcomed.

TIA

T
Mar 11 '09 #1
2 1728
JosAH
11,448 Expert 8TB
This is not a Java question; it is a Javascript question. The names may be alike but the languages are not. Do you want me to move your question to the Javascript forum?

kind regards,

Jos (moderator)
Mar 11 '09 #2
Jibran
30
This behaviour is caused by Internet bots. To prevent this, make certain fields mandatory on the form at the time of submission.
Mar 11 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically...
4
by: sean | last post by:
HI All, I have a function that validates a form, when the function returns true or false it still does not submit the form. I am using a <div> tag with text to submit the form. I have tried the...
5
by: cmc_dermo | last post by:
I have a form that has a select list. A user chooses a value and the page refreshes showing the selected value in the dropdown box. So I want to use Javascript to get the selected query from...
14
by: charlie_M | last post by:
Is there a way to blank the screen in a FORM's onsubmit=... to blank the screen for the user?? I asked this before and got a way to blank a table by id with ...
2
by: Poko | last post by:
Hi all Was wondering if someone could show me how I can use javascript to submit a form using three separate buttons that would cause the forms action="" to hold different values? Poko
5
by: Advo | last post by:
Basically, im redesigning a form page on our website. Currently the user submits the form, it does a few javascript checks and either submits to the "processstuff.php" page, or gives the user a...
14
Plater
by: Plater | last post by:
I'm going to stab myself in the face. I have a page with a single form. Regular old html. There are a few checkboxes and textboxes and and two submit buttons (I hope that's not the issue...) The...
6
by: 0utlawza | last post by:
Hi Guys 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...
13
Frinavale
by: Frinavale | last post by:
I've been trying all morning to cancel a form submit to the server. I have a JavaScript Object that determines whether or not the page should be submitted to the server depending on whether the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.