<html>
<title>application</title>
<style type= text/css>
<!--
style1

font-family: Arial, Helvetica, sans-serif;
color: =00000000;
}
-->
</style>
<head><script language="JavaScript">{

function upper( field )
{
field.value = field.value.toUppercase();
}
<!--
function validate()
{
var good = true;
with( document.theForm )
{
if( id.value =="")
{
alert("Please provide a student number combination of NUMBER and letter ex. NG08500231");
good = false;
}
if( firstname.value =="")
{
alert("Please provide first name.");
good = false;
}
if ( lastname.value =="")
{
alert("Please provide last name.");
good = false;
}
if course.value =="")
{
alert("Please provide course");
good = false;
}
if year.value =="")
{
alert("Please provide year");
good = false;
}
}
return (good);
}
//-->
</script>
</head>
<body color="grey">
<form action="" method="POST" name="TheForm" class style1 on submit="JavaScript: return( validate() );">


<b><font color=red></b>
<h2><b>STUDENT FORM</b></h2>
<b>Enter your student ID:     <input type=teat name="id"        size=15 onKeyUp="JavaScript: upper(this);"><br>
<b>  Enter your First Name:   <input type=text name="firstname" size=15 onKeyUp="Javascript: upper(this);"><br>
<br> Enter your Last  Name:   <input type=text name="lastname"  size=15 onKeyUp="Javascript: upper(this);"><br>
<br>                Course:   <input type=text name="course"    size=15 onKeyUp="Javascript: upper(this);"><br>
<br>                  Year:   <input type=text name="year"      size=15 onKeyUp="Javascript: upper(this);"><br>
<br>
<input type=submit name"submit" value="Submit!">
<input type=reset name= reset value="Reset!">
</form>
</body>
</html>


>the submit button and alert boxes doesnt work please help

Recommended Answers

Please clarify where your problem is for us to help you.
adding comments to your code would be nice.

thank you.

Jump to Post

All 4 Replies

Please clarify where your problem is for us to help you.
adding comments to your code would be nice.

thank you.

you have a

<b>Enter your student ID:     <input type=teat name="id"        size=15 onKeyUp="JavaScript: upper(this);"><br>

that's what I saw

second.

67.<input type=submit name"submit" value="Submit!">
68.<input type=reset name= reset value="Reset!">

there's no reset type attribute (68), replace it with type=clear and the name attribute shall have = operator(67)

1) in the function upper(), write
field.value = field.value.toUpperCase() instead of toUppercase()
2) write an equals sign between name and "submit":
<input type=submit name="submit" value="Submit!">

hai darylglenng and to all,

along with the modifications which are specified in above posts

please also do the following things:

  1. remove or comment <!-- this at line no 18

2.at line no 39 and 44 you missed the '(' for if condition

it should be like

if(course.value =="")
{
     // your code 
}
if(year.value =="")
{
// your code 
}

and also you stylesheet code would be like as follows

<style type="text/css">  

.style1{
     font-family: Arial, Helvetica, sans-serif;
     color: #00000000;
}

</style>

your form tag should be like as

<form action="" method="POST" name="TheForm" class="style1" onsubmit="JavaScript: return(validate());">

check it once by changing the code as desribed above

let me know the status

happy coding
[Modified]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.