0
5.2kviews
Write JavaScript program to validate a form which accepts name, age, Email, and phone number of a student

Mumbai University > Information Technology > Sem 4 > Web Programming

Marks: 10M

Year: Dec 2014, Dec 2015

1 Answer
0
307views
<html>
<head>
<title> FormData</title>
<script>
function myFunction() 
{
message("The form was submitted");
}
</script>
</head>

<body>

<h1> Enter Student's information</h1>

<form onsubmit="myFunction()">

Name: <input type="text" name="studentname" required>
<br>
Age: <input type="text" name="Age" pattern="[0-9]{2}" title="Please enter 
valid age" required>
<br>
Email id: <input type="text" name="Emailid" pattern="^\w+([\.-
]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" title="Please enter valid email id" 
required>
<br>
Phone Number: <input type="number" name="PhoneNo" pattern="[0-
9]{10}" title="Please enter valid phone number" required>
<br>

<input type="submit" value="Submit">
</form>
</body>
</html>
Please log in to add an answer.