Marketo-Formularvalidierung mit AbrufJavaScript

Javascript-Forum
Anonymous
 Marketo-Formularvalidierung mit Abruf

Post by Anonymous »

Ich habe eine Abruffunktion hinzugefügt, um eine versteckte Validierung auf einem Marketo-Formular durchzuführen. Das externe Feld gibt true oder false zurück. Das Formular wird immer gesendet, auch wenn die Validierung fehlschlägt.

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.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post