IWP Digital Assignment - 1
IWP Digital Assignment - 1
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<style>
body {
background-color: #f5f5f5;
margin: 0;
padding: 20px;
.form-container {
width: 700px;
margin: 0 auto;
background-color: #fff;
border-radius: 5px;
padding: 20px;
}
.form-header {
text-align: center;
font-size: 18px;
margin-bottom: 20px;
font-weight: bold;
.section {
margin-bottom: 20px;
.section-header {
background-color: #e9e9e9;
padding: 10px;
margin: 0;
font-size: 16px;
font-weight: bold;
margin-bottom: 10px;
.form-group {
margin: 10px 0;
}
.form-group label {
display: block;
font-size: 14px;
margin-bottom: 5px;
.form-group input,
.form-group textarea {
padding: 8px;
border-radius: 3px;
font-size: 14px;
margin-left: 10px;
textarea {
resize: none;
small {
display: block;
margin-top: 5px;
color: #999;
font-size: 12px;
}
.form-row {
display: flex;
justify-content: space-between;
.form-row .form-group {
width: 48%;
.form-actions {
text-align: center;
margin-top: 20px;
button {
margin: 5px;
font-size: 14px;
border: none;
border-radius: 3px;
cursor: pointer;
}
button:hover {
opacity: 0.9;
button[type="submit"] {
background-color: #007bff;
color: white;
button.clear-btn {
background-color: #6c757d;
color: white;
button.cancel-btn {
background-color: #dc3545;
color: white;
</style>
</head>
<body>
<div class="form-container">
<form id="registrationForm">
<div class="form-row">
<div class="form-group">
</div>
<div class="form-group">
</div>
</div>
<div class="form-row">
<div class="form-group">
</div>
<div class="form-group">
</div>
</div>
<div class="form-row">
<div class="form-group">
</div>
<div class="form-group">
</div>
</div>
<div class="form-row">
<div class="form-group">
</div>
<div class="form-group">
</div>
</div>
</div>
<div class="section">
<div class="form-row">
<div class="form-group">
<div class="form-group">
</div>
</div>
<div class="form-group">
</div>
</div>
<div class="form-actions">
<button type="submit">Register</button>
</div>
</form>
</div>
<script>
function cancelForm() {
document.getElementById("registrationForm").reset();
}
</script>
</body>
</html>
b. Username: It should not have any digits (Ex: pavan540, is not a valid name)
c. Password: it should have at least one small case letter, uppercase letter, digit and
a special character with minimum password length of 8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Signup Form</title>
<style>
body {
max-width: 600px;
padding: 20px;
background-color: #f4f4f4;
border-radius: 10px;
h2 {
text-align: center;
form {
display: flex;
flex-direction: column;
}
input {
padding: 10px;
margin: 10px 0;
font-size: 16px;
border-radius: 5px;
button {
padding: 10px;
font-size: 16px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
button:hover {
background-color: #45a049;
.error {
color: red;
font-size: 14px;
}
.success {
color: green;
font-size: 14px;
</style>
</head>
<body>
<h2>Signup Form</h2>
<form id="signupForm">
<button type="submit">Submit</button>
</form>
<script>
document.addEventListener('contextmenu', function(event) {
event.preventDefault();
});
document.getElementById('signupForm').addEventListener('submit',
function(event) {
event.preventDefault();
feedback.innerHTML = "";
if (!regNumRegex.test(regNum)) {
document.getElementById('registrationNumberError').innerText =
"Invalid registration number format.";
isValid = false;
} else {
document.getElementById('registrationNumberError').innerText = "";
if (!usernameRegex.test(username)) {
document.getElementById('usernameError').innerText = "Username
should not contain any digits.";
isValid = false;
} else {
document.getElementById('usernameError').innerText = "";
if (!passwordRegex.test(password)) {
isValid = false;
} else {
document.getElementById('passwordError').innerText = "";
isValid = false;
} else {
document.getElementById('mobileError').innerText = "";
if (!dobRegex.test(dob)) {
isValid = false;
} else {
document.getElementById('dobError').innerText = "";
if (isValid) {
feedback.style.color = "green";
} else {
feedback.style.color = "red";
}
});
</script>
</body>
</html>