Programmers step in please

ok … what’s wrong with this code. I’m getting the form, but I can’t get the friggin’ thing to verify the data entered for me :frowning: Any help would be appreciated.


<html>
<head>
<title> Function - Passing Parameters & Returning Values</title>



 <form name="form1" method="post" action="[email protected]">
 <h2><center>Computer Order Form</h2>
 <h3>You have to be 18 or over to order </center></h3>


 <h4>Please enter your name and age below: </h4>
 Name: 

 <input type="text" name="custName" value="" >

 Age: 

 <input type="text" name="custAge" value="" size="2" >


 <h4>Select your CPU speed: </h4>
 <input type="radio" name="cpuSpeed" value="800 MHz">800 MHz 

 <input type="radio" name="cpuSpeed" value="1.2 GHz">1.2 GHz 

 <input type="radio" name="cpuSpeed" value="1.8 GHz">1.8 GHz 

 <input type="radio" name="cpuSpeed" value="2.2 GHz" checked="checked"> 2.2 GHz 


 <h4>Select the accessories you want: </h4>
 <input type="checkbox" name="dvd rom" value="DVD ROM">DVD ROM 

 <input type="checkbox" name="cd rw" value="CD R/W">CD R/W 

 <input type="checkbox" name="dvd rw" value="DVD R/W">DVD R/W 

 <input type="checkbox" name="DigiCam" value="DigiCam">DigiCam 
 

 <input type="submit" value="Submit" />

 </form>

<script language="JavaScript">

function age_onblur() {
var customerAge = document.form1.custAge;
if (isNaN(customerAge.value) == true)
{ window.alert("Please enter a number for age");
customerAge.focus() ; //focus on field
customerAge.select() ; //select current entry for replacement
}

else
 { if(customerAge.value < 18)
 { window.alert("To order, you must be 18 or older. 
 If entered wrong, please enter correct age.");
 customerAge.focus();
 customerAge.select(); }
} }


 function checkForm() {
if (document.form1.custName.value == ""|| document.form1.custAge.value == "")
{ window.alert("Please enter both Name and Age");
if (document.form1.custName.value == "")
{document.form1.custName.focus() ; }
else
{document.form1.custAge.focus() ; }
} } 


</script>


</head>
</html>

I think you forgot to put a ">" some where.

Where are ur computer geeks when u need them :rolleyes:

cos its in the wrong forum… post in Comp section…

good idea… thanks :blush:

I would help but i don't like you, so yeah... :p

^^lol you're such an ass to every guy. Can't you just go with the flow?

(tilts her head looking at the screen) - Nope, still looks gibberish.

[QUOTE]
*Originally posted by RoCKiSTaN: *
^^lol you're such an ass to every guy. Can't you just go with the flow?
[/QUOTE]

can you stop following me, stalker

i need to look at the code...

Re: Programmers step in please

are u calling the verifying routine on submit?

like where are u calling the CheckForm routine?

dude.. u need to enter something like this

ie.

< INPUT TYPE=“button” NAME=“Submit” VALUE=“Submit” onClick=“runSubmit(this.form, this)”>

in the runsubmit section, you should enter the name of your lil routine that verifies the data… u should be ok then :k:

:nono:
hmm u should do ur assignmnets urself …
it will help later in professional life … trust me …!

ok i have looked at the code ... !
2 major problems .... several small ones ...

  • first major problem: ur code does not have a tag. The form must go in the body ... !!! not in the head ... only the javascript function go in the head..

  • second major problem is that the form action should lead to a javascript function (as sadzz pointed out).. onClink = someValidation() or client side and action = someValidation.(jsp or asp or php) (for server side)...

Did I ask for ur help ??? :rolleyes:

Thanks … you’re a genius !!! :k:
It’s working now :slight_smile:

Thanks man … fixed both of these problems. U guys are some real good debuggers. :k:

and BTW … I do my assignments myself, but the prof for this course is a REAL @$$hole. :stuck_out_tongue: so I never go to class. You should listen to his hard Indian accent :rolleyes:

which uni do u go to ...?

University of Windsor .
But I’m NOT in the Computer Science Program just for the record. We have the world’s worst Computer Science Department :dhimpak:

good to hear… cant believe i was some help… thats a first hehe