Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
- new js script for donation was updated
  • Loading branch information
Amita-NK authored Dec 16, 2023
1 parent c367dc1 commit 3801382
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assignments/CB.EN.U4CYS22067/ui/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function validateForm() {
return true;
}
function redirectToThanks() {
window.location.href = "../html/thanks.html";
window.location.href = "thanks.html";
}

function submitForm() {
Expand Down
63 changes: 63 additions & 0 deletions Assignments/CB.EN.U4CYS22067/ui/js/scriptd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
function validateForm() {
var fullName = document.getElementById("fullName").value;
var phoneNumber = document.getElementById("phoneNumber").value;
var amount = document.getElementById("amount").value;

if (fullName === "" || phoneNumber === "" || amount === "") {
alert("All fields are required");
return false;
}

if (isNaN(phoneNumber) || phoneNumber.length !== 10) {
alert("Invalid phone number. Please enter a 10-digit number.");
return false;
}

if (amount <= 0) {
console.log("test");
alert("Invalid amount. Please donate a positive amount.");
return false;
}

return true;
}
function redirectToThanks() {
window.location.href = "thanks.html";
}

function submitForm() {
if (validateForm()) {
redirectToThanks();
}
}



//function validateForm() {
// var fullName = document.getElementById("fullName").value;
//var phoneNumber = document.getElementById("phoneNumber").value;
//var amount = document.getElementById("amount").value;

//if (fullName === "" || phoneNumber === "" || amount === "") {
// alert("All fields are required");
// return false;
//}

//if (isNaN(phoneNumber) || phoneNumber.length !== 10) {
// alert("Invalid phone number. Please enter a 10-digit number.");
// return false;
// }

// if (parseInt(amount) <= 0) {
// alert("Invalid amount. Please donate a positive amount.");
// return false;
//}
//function redirectToThanks() {
// window.location.href = "thanks.html";
//}

//function submitForm() {
//if (validateForm()) {
//redirectToThanks();
//}
// }

0 comments on commit 3801382

Please sign in to comment.