Code: Select all
form.onSubmit(async function(form) {
let vals = form.vals();
let code = vals.flexField2;
let response = await fetch("/ajax-event-code.php?code=" + code)
let mybool = await response.text();
if (!mybool) {
form.showErrorMessage("Your event code is incorrect");
form.submittable(false);
} else {
form.submittable(true);
}
});
My question is how do I stop the form submitting even when the response is false.
Mobile version