Streaming live at 10am (PST)

Form validation not triggering

Hi all,

I’m trying to set up a simple form validation using jqueryvalidation.org

It’s a very simple plug in which uses the standard HTML attributes to validate and display custom error messages.

The issue is, the script is not triggering. It seems like Webflow is blocking it from triggering?

For reference, all the plugin asks to do is to link the js file:

<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script>

And call the script referencing the form ID:

<script>
    $("#myForm").validate();
</script>

But somehow webflow is not letting the script run.

Any ideas will be much appreciated!

maybe try the webflow wrapper like so:

var Webflow = Webflow || [];
Webflow.push(function () {
  $("#myForm").validate();
}

Can you please share the link to your website? That way us developers can help you out by getting our hands on it!

Thank you @anthonysalamin and @Jeandcc

It seems like I found the issue.

Screenshot 2020-01-08 at 19.12.11

I was adding the ID to the ‘Form Block’ on Webflow, which is not a Form tag but a DIV.
To add the ID to the Form tag you need to add it to that Form element right inside the ‘Form Block’.

Hope that makes sense!

1 Like

Awesome ! That has always annoyed me haha In my opinion, the actual form element should have a different icon isntead of the form-block that is simply a div

1 Like

Agree! A different icon for the form element would do the trick. Specially since the Form Block does have a different icon, so it’s a bit misleading.

1 Like