Skip to content

Commit

Permalink
Merge pull request #3410 from SalehaTabassum/cards
Browse files Browse the repository at this point in the history
Fixed issue #3400 form validation
  • Loading branch information
sailaja-adapa authored Oct 14, 2024
2 parents d1c9027 + 0be8e17 commit 5320fa4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions assets/html/donate.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<body>
<div class="form-container">
<h1>Donate Books to Library</h1>
<form id="donationForm">
<form id="donationForm" onsubmit="submitForm(event)">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required />
Expand All @@ -124,7 +124,7 @@ <h1>Donate Books to Library</h1>
</select>
</div>
<div class="form-group">
<button type="button" onclick="submitForm()">Submit</button>
<button type="submit" onclick="submitForm()">Submit</button>
</div>
</form>
<div id="thankYouMessage" class="thank-you-message">
Expand All @@ -134,7 +134,8 @@ <h1>Donate Books to Library</h1>
</div>

<script>
function submitForm() {
function submitForm(event) {
event.preventDefault();
// Hide the form
document.getElementById("donationForm").style.display = "none";

Expand Down
7 changes: 4 additions & 3 deletions assets/html/ngo.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<body>
<div class="form-container">
<h1>Donate Books to Organization</h1>
<form id="donationForm">
<form id="donationForm" onsubmit="submitForm(event)">
<div class="form-group">
<label for="name">Name of Donor:</label>
<input type="text" id="name" name="name" required />
Expand Down Expand Up @@ -120,7 +120,7 @@ <h1>Donate Books to Organization</h1>
</select>
</div>
<div class="form-group">
<button type="button" onclick="submitForm()">Submit</button>
<button type="submit" onclick="submitForm()">Submit</button>
</div>
</form>
<div id="thankYouMessage" class="thank-you-message">
Expand All @@ -130,7 +130,8 @@ <h1>Donate Books to Organization</h1>
</div>

<script>
function submitForm() {
function submitForm(event) {
event.preventdefault();
// Hide the form
document.getElementById("donationForm").style.display = "none";

Expand Down
8 changes: 5 additions & 3 deletions assets/html/school.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<body>
<div class="form-container">
<h1>Donate Books to School</h1>
<form id="donationForm">
<form id="donationForm" onsubmit="submitForm(event)">
<div class="form-group">
<label for="name">Name of Donor:</label>
<input type="text" id="name" name="name" required />
Expand All @@ -120,7 +120,7 @@ <h1>Donate Books to School</h1>
</select>
</div>
<div class="form-group">
<button type="button" onclick="submitForm()">Submit</button>
<button type="submit">Submit</button>
</div>
</form>
<div id="thankYouMessage" class="thank-you-message">
Expand All @@ -130,7 +130,9 @@ <h1>Donate Books to School</h1>
</div>

<script>
function submitForm() {
function submitForm(event) {
event.preventDefault(); // Prevent the default form submission

// Hide the form
document.getElementById("donationForm").style.display = "none";

Expand Down

0 comments on commit 5320fa4

Please sign in to comment.