FIX_Customer validation redo
This commit is contained in:
parent
0bca631a03
commit
1fb5e647fe
@ -40,8 +40,8 @@
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmail" class="col-form-label">Email</label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" />
|
||||
<label for="cmail" class="col-form-label">Email<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="cmail" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" onkeyup="validateEmail(this.value)" onchange="checkExisting(this.value,'email','cmail')" required />
|
||||
<span id="emailValidationMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
@ -556,16 +556,18 @@
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
if (form.checkValidity() === false) {
|
||||
var form = event.target;
|
||||
|
||||
// Check if form is valid
|
||||
if (!form.checkValidity()) {
|
||||
event.preventDefault(); // Prevent form submission
|
||||
form.reportValidity(); // Display validation error messages
|
||||
$('#submitBtn').prop('disabled', false); // Re-enable the button
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true); // Disable the button to prevent duplicate submissions
|
||||
}
|
||||
});
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function validateEmail(email) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user