Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using undefined validator #429

Closed
QuentinVaut opened this issue Apr 26, 2016 · 10 comments
Closed

Using undefined validator #429

QuentinVaut opened this issue Apr 26, 2016 · 10 comments

Comments

@QuentinVaut
Copy link
Contributor

QuentinVaut commented Apr 26, 2016

Hello, thanks for this great plugins but I 've problem, my browser say :
Using undefined validator for all my modules.
erroformvalidation
My code : http://pastebin.com/3BZ6bmb2

When I use this plugin with classic HTML work fine but when I use it on ASPX page I've these errors.
All files for modules are correctly loaded by browser.

@victorjonsson
Copy link
Owner

What version of the plugin are you using? Can you confirm that the module files are loaded in the console. They must be located in js/plugins/form-validator/ for your code to work.

@victorjonsson
Copy link
Owner

You could try thisto check that the plugin can load the module files

 <script type="text/jscript" src="js/jquery.js"></script>
    <script type="text/jscript" src="js/plugins/form-validator/jquery.form-validator.min.js"></script>
    <script>

     $.formUtils.loadModules('location, date', null, function() {
         alert('modules loaded...');
     }); 
    </script>

@QuentinVaut
Copy link
Contributor Author

QuentinVaut commented Apr 26, 2016

<script>

        $.formUtils.loadModules('location, date, security, file', null, function () {
            alert('modules loaded...');
        }); 
    </script>

Say "modules loaded". I use the last release on master branch.
Show the modules loaded in my browser :

loadedmodules

@victorjonsson
Copy link
Owner

Could you also try this and check what you can see in the console

$.formUtils.loadModules('location, date, security, file', null, function () {
   console.log('modules loaded...');
   console.log($.formUtils.validators);
}); 

@QuentinVaut
Copy link
Contributor Author

My result :

Object {validate_email: Object, validate_domain: Object, validate_required: Object, validate_length: Object, validate_url: Object…}

@victorjonsson
Copy link
Owner

Sorry I need to see them all..

$.formUtils.loadModules('location, date, security, file', null, function () {
   console.log('modules loaded...');
   console.log( Object.keys($.formUtils.validators) );
}); 

@QuentinVaut
Copy link
Contributor Author

QuentinVaut commented Apr 26, 2016

Show all modules are loaded :

modules loaded...
test.aspx:249 ["validate_email", "validate_domain", "validate_required", "validate_length", 

"validate_url", "validate_number", "validate_alphanumeric", "validate_custom", "validate_date", 

"validate_checkbox_group", "validate_country", "validate_federatestate", "validate_longlat", 

"validate_time", "validate_birthdate", "validate_mime", "validate_extension", "validate_size", 

"validate_dimension", "validate_spamcheck", "validate_confirmation", "validate_creditcard", 

"validate_cvv", "validate_strength", "validate_server", "validate_letternumeric"

, "validate_recaptcha"]

@victorjonsson
Copy link
Owner

victorjonsson commented Apr 27, 2016

Hm.. could you try this:

var setupValidation = function() {
  $.validate({
    lang: 'fr'
  });

  $('#country').suggestCountry();

  // Restrict presentation length
  $('#presentation').restrictLength($('#pres-max-length'));  
};

$.formUtils.loadModules('location, date, security, file', null, setupValidation);

@QuentinVaut
Copy link
Contributor Author

Yes, it works fine ! Thanks you !

@ManuSbd
Copy link

ManuSbd commented May 5, 2016

Hey,

I try this way but i can't load modules i'm getting errors, I try yor code "See them all":

date.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ date.js:9(anonymous function) @ date.js:9(anonymous function) @ date.js:9(anonymous function) @ date.js:9
location.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ location.js:9(anonymous function) @ location.js:9(anonymous function) @ location.js:9(anonymous function) @ location.js:9
file.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ file.js:9(anonymous function) @ file.js:9(anonymous function) @ file.js:9(anonymous function) @ file.js:9
security.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ security.js:9(anonymous function) @ security.js:9(anonymous function) @ security.js:9(anonymous function) @ security.js:9
(index):127 modules loaded...
(index):128 Uncaught TypeError: Cannot read property 'validators' of undefined

When I try your next code I get this

location.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ location.js:9(anonymous function) @ location.js:9(anonymous function) @ location.js:9(anonymous function) @ location.js:9
date.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ date.js:9(anonymous function) @ date.js:9(anonymous function) @ date.js:9(anonymous function) @ date.js:9
security.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ security.js:9(anonymous function) @ security.js:9(anonymous function) @ security.js:9(anonymous function) @ security.js:9
file.js:9 Uncaught TypeError: Cannot read property 'addValidator' of undefined(anonymous function) @ file.js:9(anonymous function) @ file.js:9(anonymous function) @ file.js:9(anonymous function) @ file.js:9
(index):127 Uncaught TypeError: $.validate is not a function

Any idea? I change "null" for the route where is form-validator

Thanks.

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

No branches or pull requests

3 participants