-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- new js script for donation was updated
- Loading branch information
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
//} | ||
// } |