Skip to content

Added registeration form #367

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

Open
wants to merge 1 commit into
base: master
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
143 changes: 143 additions & 0 deletions Registration_form_withjsvalidations/register_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<html>
<head backgound-color:"aqua";>
<script>
function validation() {
var name =
document.forms.RegForm.Name.value;
var email =
document.forms.RegForm.EMail.value;
var phone =
document.forms.RegForm.Telephone.value;
var what =
document.forms.RegForm.Subject.value;
var password =
document.forms.RegForm.Password.value;
var address =
document.forms.RegForm.Address.value;
var regEmail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/g; //Javascript reGex for Email Validation.
var regPhone=/^\d{10}$/; // Javascript reGex for Phone Number validation.
var regName = /\d+$/g; // Javascript reGex for Name validation

if (name == "" || regName.test(name)) {
window.alert("Please enter your name properly.");
name.focus();
return false;
}

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

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

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

if(password.length <8){
alert("Password should be atleast 6 character long");
password.focus();
return false;

}
if (phone == "" || !regPhone.test(phone)) {
alert("Please enter valid phone number.");
phone.focus();
return false;
}

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

return true;
}
</script>

<style>
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" onsubmit="return validation()" 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="password"
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>

</select>
</p>

<br />
<br />



<p>
<input type="submit"
value="Submit" name="Submit" />
<input type="reset"
value="Reset" name="Reset" />
</p>

</form>
</body>
</html>