Skip to main content

JAVASCRIPT FORM VALIDTION


JAVASCRIPT FORM VALIDTION


<html>
<head>
<script>
function COLLEGETAK()
{
var name = document.forms["RegForm"]["Name"];
var email = document.forms["RegForm"]["EMail"];
var phone = document.forms["RegForm"]["Telephone"];
var what = document.forms["RegForm"]["Subject"];
var password = document.forms["RegForm"]["Password"];
var address = document.forms["RegForm"]["Address"];

if (name.value == "")
{
window.alert("Please enter your name.");
name.focus();
return false;
}

if (address.value == "")
{
window.alert("Please enter your address.");
address.focus();
return false;
}

if (email.value == "")
{
window.alert("Please enter a valid e-mail address.");
email.focus();
return false;
}

if (phone.value == "")
{
window.alert("Please enter your telephone number.");
phone.focus();
return false;
}

if (password.value == "")
{
window.alert("Please enter your password");
password.focus();
return false;
}

if (what.selectedIndex < 1)
{
alert("Please enter your course.");
what.focus();
return false;
}

return true;
}</script>

<style>
COLLEGETAK{
margin-left: 70px;
font-weight: bold ;
float: left;
clear: left;
width: 100px;
text-align: left;
margin-right: 10px;
font-family:sans-serif,bold, Arial, Helvetica;
font-size:14px;
}

div {
box-sizing: border-box;
width: 100%;
border: 100px solid black;
float: left;
align-content: center;
align-items: center;
}

form {
margin: 0 auto;
width: 600px;
}</style></head>

<body>
<h1 style="text-align: center"> REGISTRATION FORM </h1>
<form name="RegForm" action="/submit.php" onsubmit="return COLEGETAK()" method="post">

<p>Name: <input type="text" size=65 name="Name"> </p><br>
<p> Address: <input type="text" size=65 name="Address"> </p><br>
<p>E-mail Address: <input type="text" size=65 name="EMail"> </p><br>
<p>Password: <input type="text" size=65 name="Password"> </p><br>
<p>Telephone: <input type="text" size=65 name="Telephone"> </p><br>

<p>SELECT YOUR COURSE
<select type="text" value="" name="Subject">
<option>BTECH</option>
<option>BBA</option>
<option>BCA</option>
<option>B.COM</option>
<option>COLLEGETAK</option>
</select></p><br><br>
<p>Comments: <textarea cols="55" name="Comment"> </textarea></p>
<p><input type="submit" value="send" name="Submit">
<input type="reset" value="Reset" name="Reset">
</p>
</form>
</body>
</html>

// updated by patelshrey115

Comments

Popular posts from this blog

Industry Ethics and Legal Issues MCQ Questions With Answer

ETHICS ALL POSSIBLE QUESTION - SET 1 Q1. Before 16 Jan, How many states were already working in Startup India policies? a) 1 b) 3 c) 4 d) 7 Q2. Which of the following is not a part of Funding Innovation? a) Incubation Center b) Startup Yatra Funds c) Research Parks d) Manak Q3. For R& D, human resource started a new scheme for students a) Tinkering labs b) Manak c) Avishkar yojana d) Uchhatar Avishkar yojana Q4. Startup India Scheme? 1. Age should not be more than 3 years 2. Should develop innovative product. 3. Must be Private Limited Company/ Registered Partnership firm/ Limited Liability Partnership 4. Has patent granted in areas affiliated with the nature of business being promoted a) 1, 3 6) 1,2 and3 c) 2, 3 and 4 d) All of the above Q5. The period of business when an entrepreneur must position the venture in a market and make necessary adjustments to assure survival is called the: a) pre-Startup stage b) Startup singe ...

DIGITAL MARKETING

DIGITAL MARKETING END TERM PRACTICAL PAPERS:

WEB DEVELOPMENT COURSE

CLICK ON LINK AND ENJOY THE COURSE.  LINK : BUILDING YOUR FIRST WEBSITE IN HTML