Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Project. #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions JS-User Registration/GET METHOD FORM SUBMISSION.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<html>
<head>
<title>Form Validation</title>
<script type = "text/javascript">
function validate() {
var text;
if( document.myForm.name.value == "" ) {
text = "Name cannot be empty";
document.getElementById("demo").innerHTML = text;
document.myForm.name.focus() ;
return false;
}
if( document.myForm.email.value == "" ) {
text = "E-mail cannot be empty";
document.getElementById("demo").innerHTML = text;
document.myForm.email.focus() ;
return false;
}
var emailID = document.myForm.email.value;
atposn = emailID.indexOf("@");
dotposn = emailID.lastIndexOf(".");
if (atposn < 1 || ( dotposn - atposn < 2 )) {
text = "Please enter valid email ID";
document.getElementById("demo").innerHTML = text;
document.myForm.email.focus() ;
return false;
}
if( document.myForm.phone.value == "" || isNaN( document.myForm.phone.value ) ||
document.myForm.phone.value.length != 10 ) {
text = "Please enter a valid 10-digit phone number";
document.getElementById("demo").innerHTML = text;
document.myForm.phone.focus() ;
return false;
}
if( document.myForm.subject.value == "0" ) {
text = "Please provide your area of expertise";
document.getElementById("demo").innerHTML = text;
return false;
}
return( true );
}
</script>
</head>
<body>
<form action = "" name = "myForm" onsubmit = "return(validate());">
<h1 align="center">USER REGISTRATION</H1>
<table align="center" cellspacing = "3" cellpadding = "3" border = "3">
<tr>
<td align = "right">Name</td>
<td><input type = "text" name = "name" /></td>
</tr>
<tr>
<td align = "right">E-mail</td>
<td><input type = "text" name = "email" /></td>
</tr>
<tr>
<td align = "right">Phone Number</td>
<td><input type = "text" name = "phone" /></td>
</tr>
<tr>
<td align = "right">Subject</td>
<td>
<select name = "subject">
<option value = "0" selected>Select</option>
<option value = "1">HTML</option>
<option value = "2">JavaScript</option>
<option value = "3">CSS</option>
<option value = "4">JSP</option>
</select>
</td>
</tr>
</table>
<p id="demo" style="color:red; text-align:center"></p>
<div style="text-align:center"><input type = "submit" value = "Submit" /></div>
</form>
</body>
</html>