Menu icon Foundation
using abide with on click event

Hi everybody! Hans emailed us with a question about Abide. Let's help him out!

--

Hi,
I want to use the abide validation with a serie of inputs, but without a submit button. Instead I’ve a on click event which fires a javascript function after validation =OK

Any suggestions?

Thank you!

Hans

abideformvalidationjsjavascript

Hi everybody! Hans emailed us with a question about Abide. Let's help him out!

--

Hi,
I want to use the abide validation with a serie of inputs, but without a submit button. Instead I’ve a on click event which fires a javascript function after validation =OK

Any suggestions?

Thank you!

Hans


Anton Iskandiarov gave the most helpful answer for this post
Anton Iskandiarov almost 4 years ago

Hi,

I was searching for an answer and finally found it inside foundation.js source code:

just run inside your code

$els = single input or array of inputs;
Foundation.libs.abide.parse_patterns($els);

It will validate inputs passed to the function and apply styles to inputs with validation errors. Also this method will return array with validation statuses.

Jordan Humphreys almost 4 years ago

Can you post an example of your code?

You will have to set data-abide="ajax" to disable the native form submission on validation.

You will then have to listen for the validation events on your form and trigger you callbacks then:

$('#myForm').on('valid', function () {
  // trigger your callback here
});

Anton Iskandiarov almost 4 years ago

Hi,

I was searching for an answer and finally found it inside foundation.js source code:

just run inside your code

$els = single input or array of inputs;
Foundation.libs.abide.parse_patterns($els);

It will validate inputs passed to the function and apply styles to inputs with validation errors. Also this method will return array with validation statuses.