Skip to content

Commit

Permalink
change in book donation form
Browse files Browse the repository at this point in the history
  • Loading branch information
govindgupta1912 committed Jun 13, 2023
1 parent 0ec9d1e commit 3b1364a
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions public/donate-book.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ <h2>Book Donation Form 📚</h2>
<label>Contact Number</label>
</div>

<div class="user-box">
<textarea rows="4" class="form__input form-control" type="text" name="" id="address" required=""></textarea>
<label>Address</label>
<div class="user-box">
<h6>Address<h6>
<textarea row="4" class="form-control" type="text" name="" id="address" required=""></textarea>
<label for="floatingTextarea2">Address</label>
</div>



<div class="user-box">
<label>Select Country: </label><br><br>
Expand Down Expand Up @@ -119,15 +122,15 @@ <h2>Book Donation Form 📚</h2>
</select>
</div>
<div class="user-box">
<input class="form__input form-control" id="zip" type="text" name="" required="">
<input class="form__input form-control" id="zip" type="text" name="" required="">
<label>Zip</label>
</div>
<div class="user-box">
<input class="form__input form-control" type="text" name="" required="">
<input class="form__input form-control" type="text" name="">
<label>Landmark (Optional)</label>
</div>
<div class="user-box">
<input class="form__input form-control" id="alt_contact" type="text" name="" required="">
<input class="form__input form-control" id="alt_contact" type="text" name="">
<!--onchange="validate_phone(document.getElementById('alt_contact'))"-->
<label>Alternate Phone (Optional)</label>
</div>
Expand Down Expand Up @@ -223,19 +226,26 @@ <h2>Book Donation Form 📚</h2>
if(input.value.match(phone)){
return true;
}
}
/*else{
alert("Please enter a valid phone number")
return false;
}*/

}







function reset_form(){
document.getElementById("donation_form").reset();

}

donationForm.addEventListener('submit',e=>{

if(validate_phone(document.getElementById('contact'))){
e.preventDefault();
const { data, error } = _supabase
Expand All @@ -255,6 +265,8 @@ <h2>Book Donation Form 📚</h2>
if(res.error){
alert(res.error.message);
}


else{
alert('Data Added');
reset_form();
Expand All @@ -264,6 +276,8 @@ <h2>Book Donation Form 📚</h2>
else{
alert("Please enter a valid phone number")
}


})

</script>
Expand Down

0 comments on commit 3b1364a

Please sign in to comment.