Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Problem when using allValid #88

Closed
zenopopovici opened this issue Mar 15, 2014 · 6 comments
Closed

Problem when using allValid #88

zenopopovici opened this issue Mar 15, 2014 · 6 comments

Comments

@zenopopovici
Copy link
Contributor

Hey,

Your library is absolutely perfect :)

I understand you're a bit busy, but could you help a bit. I'm trying to validate a form and then get the result.

//Validate Contact Form
$('#js-contact-form').submit( function( event ) {
    var result = $('#js-contact-form').h5Validate('allValid');
    if ( result == true ) {
        // Do stuff here
    }

}

The error I get:

 [Error] TypeError: 'undefined' is not an object (evaluating 'settings[action]')
 h5Validate (jquery-h5validate.min.js, line 1)
 (anonymous function) (main.js, line 183)
 dispatch (jquery.min.js, line 3)
 handle (jquery.min.js, line 3)

jQuery 2.1

@ericelliott
Copy link
Owner

First you need to make sure you initialize h5Validate:

$(document).ready(function () {
    $('#js-contact-form').h5Validate();
});

After it's initialized, then you can do what you're trying to do.

@ericelliott
Copy link
Owner

If you still have trouble, try posting your code on jsfiddle so that I can get a better idea of how to fix it. =)

@zenopopovici
Copy link
Contributor Author

All is 💯 . Thanks a bunch. Your library is so simple and does exactly what you want it to do, without defining everything in javascript, without bloating the code. It's perfect, and trust me, I tried all of them.
One more thing, do you accept donations?

@ericelliott
Copy link
Owner

Not directly, but you can buy my book or contribute code improvements / bug fixes to this project.

@zenopopovici
Copy link
Contributor Author

Hey Eric, I bought your book :)
I looked for a validator and ended up learning to code better Javascript.
Thanks for everything!

@ericelliott
Copy link
Owner

No problem! =)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants