PDA

View Full Version : Form Validation issue



Liam
04-22-2008, 03:38 PM
Hello,

I am trying to validate a form but im having a little trouble with it.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="STYLESHEET" href="hawaii1.css" type="text/css">
<title>Big Island - Thurston Lava Tube</title>

<script type="text/javascript" src="nav.js">

<script language="JavaScript">
<!--
function check()
{
var complete=true;
var thename=document.f1.yourname.value;
if ((thename == "") || (thename == null))
{
alert("The First name field is blank, please try again.");
complete=false;
}
return complete;
}
-->
</script>

</head>
<body bgcolor="#000000">
<div id="header"><img src="head.jpg" width="750" height="50" border="0" alt="header"></div>
<span class="preload1"></span>
<span class="preload2"></span>

<ul id="nav">
<!--li in HTML li is a list this indents itends if the preloaded images were not present the lists below would be displayed as lists-->
<li class="top"><a href="hawaiihome.html" class="top_link"><span>Home</span></a></li> <!--class "top_link" calls top_link from the css and therefore sets its height, width, font size etc for the main nav bar-->
<li class="top"><a class="top_link"><span class="down">Things To Do</span></a> <!--class "down" means drop down list - note how this is missing from the home drop down menu-->
<ul class="sub">
<li><a href="#nogo3" class="fly">Oahu</a> <!--class fly calls an image called arrow this then displays the link with an arrow.-->
<ul>
<li><a href="pearlharbour.html">Pearl Harbour</a></li>
<li><a href="wateradventure.html">Water park</a></li>
</ul>
</li>
<li><a href="#nogo7" class="fly">Maui</a>
<ul>
<li><a href="sub.html">Submarine Tour</a></li>
<li><a href="luau.html">Luau</a></li>
</ul>
</li>
<li><a href="#nogo20" class="fly">Big Island</a>
<ul>
<li><a href="zoo.html">Rainforest Zoo</a></li>
<li><a href="astro.html">Astronomy</a></li>
</ul>
</li>
<li><a href="#nogo3" class="fly">Kauai</a>
<ul>
<li><a href="kauai1.html">Relaxation</a></li>
<li><a href="kauai2.html">Horse Riding</a></li>
</ul>
</li>
<li><a href="#nogo21" class="fly">Molokai</a>
<ul>
<li><a href="nutfarm.html">Nut Farm</a></li>
</ul>
</li>
<li><a href="#nogo21" class="fly">Lanai</a>
<ul>
<li><a href="golf.html">Manele-Golf</a></li>
</ul>
</li>
</ul>
<li class="top"><a href="#nogo22" id="services" class="top_link"><span class="down">Things To See</span></a>
<ul class="sub">
<li><a href="#nogo23" class="fly">Oahu</a>
<ul>
<li><a href="hanaumabay.html">Hanauma Bay</a></li>
<li><a href="waikikibeach.html">Waikiki Beach</a></li>
</ul>
</li>
<li><a href="#nogo24" class="fly">Maui</a>
<ul>
<li><a href="whales.html">Whale Watching</a></li>
<li><a href="para.html">Paraglide</a></li>
</ul>
</li>
<li><a href="#nogo26" class="fly">Big Island</a>
<ul>
<li><a href="thruston.html">Lava Tube</a></li>
<li><a href="black.html">Black Beach</a></li>
</ul>
</li>
<li><a href="#nogo3" class="fly">Kauai</a>
<ul>
<li><a href="ferngrotto.html">Fern Grotto</a></li>
<li><a href="canyon.html">Waimea Canyon</a></li>
</ul>
</li>
<li><a href="#nogo26" class="fly">Molokai</a>
<ul>
<li><a href="Kamakou.html">Kamakou</a></li>
</ul>
</li>
<li><a href="#nogo26" class="fly">Lanai</a>
<ul>
<li><a href="shipwreck.html">Shipwreck Beach</a></li>
<li><a href="munrotrail.html">Munro Trail</a></li>
</ul>
</li>
</ul>
</li>
<li class="top"><a href="#nogo27" id="contacts" class="top_link"><span>The Islands</span></a>
<li class="top"><a href="weather.html" id="weather" class="top_link"><span>Weather</span></a></li>
<li class="top"><a href="#nogo57" id="privacy" class="top_link"><span class="down">Culture</span></a>
<ul class="sub"> <!--sub is called from the CSS this is whats called to show the list drops down the then the following "li" are placed in the drop down box (they don't just contiue along the "top"-->
<li><a href="people.html">People</a></li>
<li><a heref="#ng1">Food</a></li>
<li><a heref="#ng2">Music</a></li>
</ul>
</li>
<li class="top"><a href="gallery.html" id="privacy" class="top_link"><span>Images</span></a></li>
<li class="top"><a href="#nogo57" id="privacy" class="top_link"><span>More Information</span></a></li>
<li class="top"><a href="#nogo57" id="privacy" class="top_link"><span>About Me</span></a></li>
</ul>
</div> <!-- end of content -->

<div id="right">
For more information about Hawaii please fill in the form below

<FORM name="f1" action="hawaiihome.html" onSubmit="return check()">
Name:<input type="text" name="yourname">
<p>
<INPUT type="Submit" value="Submit">
</p>
</FORM>




</div>
<div id="side"><img src="fs1.jpg" width="90" height="304" alt="Flowerside" border="0"></div>


</body>
</html>

This is my code the problem seems to be in line 128 this is coloured red. Please could some one tell me what is wrong with this as i cannot figure it out. Every time i press the submit with nothing in the box it just comes up with an error (but not the alert error i want) Do i need to add the letters cgi in the action bit?
Any advice would be great.

Thanks :)