JAYASWAROOP commited on
Commit
701a252
1 Parent(s): a2feb81

Update audio.js

Browse files
Files changed (1) hide show
  1. audio.js +27 -0
audio.js CHANGED
@@ -1,3 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  function validateLogin() {
2
  var username = document.forms["loginForm"]["username"].value;
3
  var password = document.forms["loginForm"]["password"].value;
 
1
+ function validateSignup() {
2
+ var username = document.forms["signupForm"]["username"].value;
3
+ var password = document.forms["signupForm"]["password"].value;
4
+ var email = document.forms["signupForm"]["email"].value;
5
+
6
+ if (username === "" || password === "" || email === "") {
7
+ alert("Please enter all the required fields");
8
+ return false;
9
+ }
10
+
11
+ var existingUsernames = ['user1', 'user2', 'user3'];
12
+ if (existingUsernames.includes(username)) {
13
+ alert("Username already exists. Please choose a different username");
14
+ return false;
15
+ }
16
+
17
+ var existingEmails = ['user1@example.com', 'user2@example.com', 'user3@example.com'];
18
+ if (existingEmails.includes(email)) {
19
+ alert("Email already exists. Please enter a different email address");
20
+ return false;
21
+ }
22
+
23
+ // If all validations pass, you can proceed with submitting the form
24
+ return true;
25
+ }
26
+
27
+
28
  function validateLogin() {
29
  var username = document.forms["loginForm"]["username"].value;
30
  var password = document.forms["loginForm"]["password"].value;