Ex 5 IP - PDF
Ex 5 IP - PDF
Ex 5 IP - PDF
No :5
Aim:
The aim of this experiment is to validate the registration, user login, user profile, and payment by credit card pages
using JavaScript. By implementing validation, we can ensure that the input provided by users is correct and meets the
required criteria. This will enhance the user experience and prevent potential issues with data integrity.
Algorithm:
1. Validate that all required fields are filled in before submitting the form.
3. Ensure that passwords meet the required complexity criteria (e.g., minimum length, containing both letters and
numbers).
5. Optionally, perform additional validation specific to your application's requirements (e.g., username
uniqueness).
1. Validate that both the username/email and password fields are filled in before allowing login.
3. Optionally, implement additional security measures like rate limiting or CAPTCHA to prevent brute-force
attacks.
2. Implement additional validation for fields like phone numbers, addresses, or other user-specific information.
3. Ensure any changes made to the profile are correctly saved and updated in the database.
1. Validate the credit card number format (e.g., using regex) to ensure it matches a valid credit card pattern.
2. Implement the Luhn algorithm to validate the credit card number's checksum.
3. Verify the expiration date and CVV number against their respective criteria.
Coding:
registration.html:
<label for="email">Email:</label>
<label for="password">Password:</label>
<button type="submit">Register</button>
</form>
registration.js
<script src="registration.js"></script>
function validateRegistration(event) {
event.preventDefault();
return;
return;
login.html
<label for="loginEmail">Email:</label>
<label for="loginPassword">Password:</label>
<button type="submit">Login</button>
</form>
<script src="login.js"></script>
login.js
function validateLogin(event) {
event.preventDefault();
if (!email || !password) {
return;
profile.html
<label for="username">Username:</label>
<label for="address">Address:</label>
<button type="submit">Save</button>
</form>
<script src="profile.js"></script>
profile.js
<label for="username">Username:</label>
<label for="address">Address:</label>
<button type="submit">Save</button>
</form>
<script src="profile.js"></script>
payment.html
<label for="cvv">CVV:</label>
<button type="submit">Pay</button>
</form>
<script src="payment.js"></script>
payment.js
function validatePayment(event) {
event.preventDefault();
return;
Output :