meteorformvalidation-plugin

Including Formvalidation.io in meteor


I am developing a meteor app.

  1. I bought a copy of the formvalidation package and downloaded the zip file
  2. Copied the folder under client directory
  3. Created a file named startup.js in client directory root
  4. Added the following code

    Meteor.startup(function(){
    $.when(
        $.getScript( "lib/formvalidation/dist/js/formValidation.min.js" ),
        $.getScript( "lib/formvalidation/dist/js/framework/bootstrap.min.js"),
        $.Deferred(function( deferred ){
            $( deferred.resolve );
        })
    ).done(function(){
        console.log( "Load was performed." );
    });
    

    });

When the application loads, I see the error message:

Uncaught ReferenceError: FormValidation is not defined

Any suggestions?


Solution

  • Try moving formValidation.min.js and bootstrap.min.js to the client/compatibility directory. You won't need startup.js at all, since files in the client/ directory are automatically loaded client-side.

    client/compatibility is used for scripts that declare a global variable.