Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users able to submit form without input

Status
Not open for further replies.

rizakag

Technical User
Jun 5, 2001
11
US
I use FrontPage 2000, and I have created a registration form. I've tried everything I can think of, but users are still able to submit the form without inputting anything (ie, all fields are blank). This is messing up the system, because the results of the registration form are sent to an Excel spreadsheet, which the client uses to keep track of registrations.

I've edited every field and supposedly made input "required" but it's still not working. Any ideas?
 
Dirty and easy way...

<HTML>
<HEAD>
<TITLE> Title </TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function checkvalues(){
var ok=true;
if (document.all||document.getElementById){
for (i=0;i<formtest.length;i++){
var tempobj=formtest.elements;
if (tempobj.value == &quot;&quot; && tempobj.type.toLowerCase()!=&quot;submit&quot; && tempobj.type.toLowerCase()!=&quot;hidden&quot; && tempobj.type.toLowerCase()!=&quot;button&quot;) {
ok=false;
}
}
}
if (ok==true)
{
return true;
}
else {
alert('Fill all Fields !!');
return false;
}
}

//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD=POST NAME=&quot;formtest&quot; ACTION=&quot;whatever.asp&quot; onsubmit=&quot;return checkvalues();&quot;>
<INPUT TYPE=&quot;text&quot; NAME=&quot;name1&quot;>
<INPUT TYPE=&quot;text&quot; NAME=&quot;name2&quot;>
<INPUT TYPE=&quot;submit&quot;>
</FORM>
</BODY>
</HTML>
 
pgferro --

When I looked at my html code, I couldn't figure out how to do what you've suggested. Again, I'm using FrontPage 2000, and there's a lot of code in there, webbots and stuff, and it looks totally different than what you posted. Here's what I have:


<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<meta http-equiv=&quot;Content-Language&quot; content=&quot;en-us&quot;>
<title>NFPA Online Standards Registration Form</title>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>

<style>
.menulines{
border:1px solid white;
}

.menulines a{
text-decoration:none;
color:black;
}
</style>

<script language=&quot;JavaScript1.2&quot;>

/*
Highlight menu effect script: By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit */

function borderize(what,color){
what.style.borderColor=color
}

function borderize_on(e){
if (document.all)
source3=event.srcElement
else if (document.getElementById)
source3=e.target
if (source3.className==&quot;menulines&quot;){
borderize(source3,&quot;3366CC&quot;)
}
else{
while(source3.tagName!=&quot;TABLE&quot;){
source3=document.getElementById? source3.parentNode : source3.parentElement
if (source3.className==&quot;menulines&quot;)
borderize(source3,&quot;3366CC&quot;)
}
}
}

function borderize_off(e){
if (document.all)
source4=event.srcElement
else if (document.getElementById)
source4=e.target
if (source4.className==&quot;menulines&quot;)
borderize(source4,&quot;white&quot;)
else{
while(source4.tagName!=&quot;TABLE&quot;){
source4=document.getElementById? source4.parentNode : source4.parentElement
if (source4.className==&quot;menulines&quot;)
borderize(source4,&quot;white&quot;)
}
}
}

</script>


<meta name=&quot;Microsoft Border&quot; content=&quot;t&quot;>
</head>

<body>
<table border=&quot;0&quot; width=&quot;620&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;100%&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot; height=&quot;488&quot;>
<tr>
<td width=&quot;33%&quot; valign=&quot;top&quot; height=&quot;91&quot;><img border=&quot;0&quot; src=&quot;images/title_registration.gif&quot; width=&quot;200&quot; height=&quot;91&quot;></td>
<td width=&quot;6%&quot; valign=&quot;top&quot; rowspan=&quot;4&quot; height=&quot;488&quot;>
<p align=&quot;center&quot;><img border=&quot;0&quot; src=&quot;images/vertical_line.gif&quot; width=&quot;7&quot; height=&quot;620&quot;></td>
<td width=&quot;61%&quot; valign=&quot;top&quot; rowspan=&quot;4&quot; height=&quot;488&quot;>
&nbsp;
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;90%&quot;>
<tr>
<td width=&quot;100%&quot; valign=&quot;top&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;>You
are eligible to register and use these subscriptions if you
are:
</font></td>
</tr>
<tr>
<td width=&quot;100%&quot; valign=&quot;top&quot;>
<ul>
<li><font face=&quot;Arial&quot; size=&quot;2&quot;>A
DuPont Company employee who works out of an office in a DuPont
facility or a home office</font></li>
<li><font face=&quot;Arial&quot; size=&quot;2&quot;>A fee
contractor who works out of an office in a DuPont site and who
has &quot;DuPont&quot; in your e-mail address</font></li>
</ul>
</td>
</tr>
<tr>
<td width=&quot;100%&quot;><font face=&quot;Arial&quot; size=&quot;2&quot;><i>DuPont employees and
contractors who have offices in contractor facilities are not
permitted to use these subscriptions, because an excessive
number of users will cause the system to overload</i>.</font>
<p>&nbsp;</td>
</tr>
</table>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot; bgcolor=&quot;#FFFFFF&quot;>
<tr>
<td width=&quot;100%&quot; valign=&quot;top&quot; bgcolor=&quot;#FFFFFF&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<form method=&quot;POST&quot; action=&quot;_derived/nortbots.htm&quot; onSubmit=&quot;location.href='_derived/nortbots.htm';return false;&quot; webbot-action=&quot;--WEBBOT-SELF--&quot; WEBBOT-onSubmit>

</tr>
<tr>
<td width=&quot;100%&quot; bgcolor=&quot;#FFFFFF&quot;> <form method=&quot;POST&quot; action=&quot;--WEBBOT-SELF--&quot; onSubmit=&quot;return FrontPage_Form2_Validator(this)&quot; name=&quot;FrontPage_Form2&quot;>
<!--webbot bot=&quot;SaveResults&quot; startspan
U-File=&quot;_private/Registration.xls&quot; S-Format=&quot;TEXT/TSV&quot;
S-Label-Fields=&quot;TRUE&quot; B-Reverse-Chronology=&quot;FALSE&quot; S-Builtin-Fields
S-Form-Fields=&quot;LastName FirstName Email Title SBU Business Site &quot;
U-Confirmation-Url=&quot;confirmation.htm&quot; --><input TYPE=&quot;hidden&quot; NAME=&quot;VTI-GROUP&quot; VALUE=&quot;0&quot;><!--webbot
bot=&quot;SaveResults&quot; endspan -->
<table border=&quot;0&quot; width=&quot;100&quot; cellpadding=&quot;0&quot; height=&quot;239&quot; cellspacing=&quot;0&quot;>
<tr>
<td colspan=&quot;2&quot; height=&quot;44&quot; bgcolor=&quot;#FFFFFF&quot;><img border=&quot;0&quot; src=&quot;images/register.gif&quot; width=&quot;298&quot; height=&quot;15&quot;>
</td>
</tr>
<tr>
<td colspan=&quot;2&quot; height=&quot;44&quot; bgcolor=&quot;#FFFFCC&quot;><font face=&quot;Arial&quot; size=&quot;1&quot;><b><i>Please
enter your name and select your SBU or organization below. Then
click on the &quot;Register&quot; button.&nbsp; We are gathering
information that will help us improve our system.</i></b></font>
</td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><b> <font face=&quot;Arial&quot; size=&quot;1&quot;> Last Name:</font></b></td>
<td valign=&quot;top&quot; height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;Last Name&quot; S-Data-Type=&quot;String&quot;
B-Allow-Letters=&quot;TRUE&quot; S-Allow-Other-Chars=&quot;-&quot;
B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;LastName&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>First Name:</font></b></td>
<td valign=&quot;top&quot; height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;First Name&quot; S-Data-Type=&quot;String&quot;
B-Allow-Letters=&quot;TRUE&quot; S-Allow-Other-Chars=&quot;-&quot;
B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;FirstName&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
<tr>
<td height=&quot;30&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>Internet Address (john.q.public@usa.dupont.com):</font></b></td>
<td valign=&quot;top&quot; height=&quot;30&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;Email&quot; S-Data-Type=&quot;String&quot;
B-Allow-Letters=&quot;TRUE&quot; B-Allow-Digits=&quot;TRUE&quot;
S-Allow-Other-Chars=&quot;@&quot; B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;Email&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
<tr>
<td height=&quot;24&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>Title:</font></b></td>
<td valign=&quot;top&quot; height=&quot;24&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;Title&quot; S-Data-Type=&quot;String&quot;
B-Allow-Letters=&quot;TRUE&quot; B-Allow-WhiteSpace=&quot;TRUE&quot;
B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;Title&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>SBU:</font></b></td>
<td valign=&quot;top&quot; height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><font size=&quot;1&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;SBU&quot; B-Value-Required=&quot;TRUE&quot;
B-Disallow-First-Item=&quot;TRUE&quot; --><select size=&quot;1&quot; name=&quot;SBU&quot; style=&quot;font-size: 8pt; font-family: Arial&quot;>
<option>Select One</option>
<option>Advanced Fibers Systems</option>
<option>Central Research &amp; Development</option>
<option>Corian®</option>
<option>Corporate Services</option>
<option>Crop Protection</option>
<option>Dacron®</option>
<option>DuPont Canada</option>
<option>DuPont Dow Elastomers</option>
<option>DuPont Performance Coatings</option>
<option>DuPont Photomasks Inc.</option>
<option>DuPont Tribon Composites</option>
<option>DuPont Safety Resource Business</option>
<option>Engineering</option>
<option>Engineering Polymers</option>
<option>Fluoroproducts</option>
<option>Global Services Business</option>
<option>iTechnologies</option>
<option>Lycra®/Terathane®</option>
<option>Nonwovens</option>
<option>Nutrition &amp; Health</option>
<option>Nylon</option>
<option>Packaging &amp; Industrial Polymers</option>
<option>Pharmaceuticals</option>
<option>Pioneer Hi-Bred International</option>
<option>Polyester Films</option>
<option>Polyester Resins &amp; Intermediates</option>
<option>Specialty Chemicals</option>
<option>White Pigments &amp; Mineral Products</option>
</select></font></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>Business:</font></b></td>
<td valign=&quot;top&quot; height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;Business Unit&quot;
S-Data-Type=&quot;String&quot; B-Allow-Letters=&quot;TRUE&quot;
B-Allow-WhiteSpace=&quot;TRUE&quot; B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;Business&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
<tr>
<td height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><b><font face=&quot;Arial&quot; size=&quot;1&quot;>Site:</font></b></td>
<td valign=&quot;top&quot; height=&quot;25&quot; bgcolor=&quot;#FFFFCC&quot;><!--webbot
bot=&quot;Validation&quot; S-Display-Name=&quot;Site&quot; S-Data-Type=&quot;String&quot;
B-Allow-Letters=&quot;TRUE&quot; B-Allow-WhiteSpace=&quot;TRUE&quot;
B-Value-Required=&quot;TRUE&quot; --><input type=&quot;text&quot; name=&quot;Site&quot; size=&quot;38&quot; style=&quot;font-family: Arial; font-size: 8pt&quot;></td>
</tr>
</table>
<p><input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B3&quot;><input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;></p>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=&quot;33%&quot; valign=&quot;top&quot; height=&quot;133&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;100%&quot;>

<table border=&quot;0&quot; width=&quot;92%&quot; onMouseover=&quot;borderize_on(event)&quot; onMouseout=&quot;borderize_off(event)&quot;>
<tr>
<td width=&quot;33%&quot; class=&quot;menulines&quot;><a href=&quot;default.htm&quot;><b><font face=&quot;Arial&quot; color=&quot;#800000&quot; size=&quot;2&quot;>Access
to NFPA Codes &amp; Standards</font></b></a></td>
</tr>
<tr>
<td width=&quot;33%&quot; class=&quot;menulines&quot;><a href=&quot;registration.htm&quot;><b><font face=&quot;Arial&quot; color=&quot;#800000&quot; size=&quot;2&quot;>Registration
for Online Access</font></b></a></td>
</tr>
<tr>
<td width=&quot;33%&quot; class=&quot;menulines&quot;><a href=&quot;dupont_participation.htm&quot;><b><font face=&quot;Arial&quot; color=&quot;#800000&quot; size=&quot;2&quot;>DuPont
Participation in NEC Development Process</font></b></a></td>
</tr>
<tr>
<td width=&quot;33%&quot; class=&quot;menulines&quot;><a href=&quot; face=&quot;Arial&quot; color=&quot;#800000&quot; size=&quot;2&quot;>Corporate
Standards &amp; Guidelines</font></b></a></td>
</tr>

<tr>
<td width=&quot;33%&quot; class=&quot;menulines&quot;><a href=&quot; face=&quot;Arial&quot; color=&quot;#800000&quot; size=&quot;2&quot;>Electrical Standards Team</font></b></a></td>
</tr>


</table>
</td>
</tr>
<tr>
<td width=&quot;33%&quot; valign=&quot;top&quot; height=&quot;132&quot;></td>
</tr>
<tr>
<td width=&quot;33%&quot; valign=&quot;top&quot; height=&quot;132&quot;></td>
</tr>
</table>
</td>
</tr>
</table>
&nbsp;&nbsp;&nbsp;</td></tr></table>&nbsp;</body>
 
I'm not very practical with fronpage and its self things, but as far as i've understood from your code, we are both confused ... :)

Anyway, a couple of things :
1. You have declared 2 forms, I think the first one should be deleted fromthe code
2. Put the javascript code

function checkvalues(){
var ok=true;
if (document.all||document.getElementById){
for (i=0;i<FrontPage_Form2.length;i++){
var tempobj=FrontPage_Form2.elements;
if (tempobj.value == &quot;&quot; && tempobj.type.toLowerCase()!=&quot;submit&quot; && tempobj.type.toLowerCase()!=&quot;hidden&quot; && tempobj.type.toLowerCase()!=&quot;button&quot;) {
ok=false;
}
}
}
if (ok==true)
{
return true;
}
else {
alert('Fill all Fields !!');
return false;
}
}

in your <HEAD> section (below the others js snippets)

3. form onsubmit = &quot;return checkvalues();&quot;

It should works, even if I do not know what will happen next...

My suggestion is to forget about all FrontPage special dialects and just hard code the normal way..

If you need a more 'in depth' validator, try this link :

BYE
 
Didn't read all the code, but I noticed that your Submit button is of type &quot;submit&quot;. I've had problems where my forms would submit even if they failed the Javascript validation; to fix this I changed the input type of the button from &quot;submit&quot; to &quot;button&quot; then had Javascript call the form submit if all the validation was passed.
 
Forgot to mention, if you change the input type to button, you need to call the function that validates the form on the button's click event.

So instead of what you have:
<input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B3&quot;>

You would have:
<input type=&quot;button&quot; value=&quot;Submit&quot; name=&quot;B3&quot; onClick=&quot;checkValues()&quot;>

Then, at the end of the JS function, if all the validation tests passed, you'd add:

document.forms[0].submit();

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top