Update Banyak

This commit is contained in:
WD - Dev
2025-09-21 21:40:17 +07:00
parent c6bee729c5
commit efca8f5f80
145 changed files with 195185 additions and 1378 deletions
+39 -4
View File
@@ -51,10 +51,13 @@
<label>Nama</label>
<input type="text" class="form-control" required="required" name="nama">
</div>
<div class="form-group m-1">
<label>Email</label>
<input type="email" class="form-control" required="required" name="email">
</div>
<div class="form-group m-1">
<label>Email</label>
<input type="email" class="form-control" required="required" name="email" id="emailInput">
<small id="emailError"></small>
</div>
<div class="form-group m-1">
<label>Nomor WhatsApp</label>
<input type="text" class="form-control" required="required" name="nowa">
@@ -149,3 +152,35 @@ if (isset($_POST['tambah'])) {
}
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
const emailInput = document.getElementById("emailInput");
const emailError = document.getElementById("emailError");
const gmailRegex = /^[a-z0-9._%+-]+@gmail\.com$/;
// Saat ngetik
emailInput.addEventListener("input", function() {
this.value = this.value.toLowerCase();
if (gmailRegex.test(this.value)) {
emailError.textContent = "✅ Email valid";
emailError.style.color = "green";
} else {
emailError.textContent = "❌ Email tidak valid (harus @gmail.com & huruf kecil)";
emailError.style.color = "red";
}
});
// Saat submit
emailInput.form.addEventListener("submit", function(e) {
if (!gmailRegex.test(emailInput.value)) {
e.preventDefault(); // stop submit
emailError.textContent = "❌ Email tidak valid (harus @gmail.com & huruf kecil)";
emailError.style.color = "red";
emailInput.focus();
}
});
});
</script>
<script type="text/javascript" src="dist/js/mapsFormCustom.js"></script>