Best way to do javascript validation in a nodebb plugin?



  • I have several number and string fields in my plugin-rendered page through a custom template edit_info.tpl.
    Everything is working fine and wanted to add some validations for the fields before submitting.
    What would be the best way to achieve this?
    I was looking at a 3-party jQuery Validation Plugin module (http://jqueryvalidation.org/), but it doesn't seem to work well with nodebb.
    Somehow

    Here's part of edit_info.tpl.

    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.min.js"></script>
    <script>
     if ($.validator) {
        alert('#1 validator ok');
    } else {
    	alert('#1 validator NOT accessible!');
    }
    </script>
    

    The validator is not accessible when testing the above script.
    Not sure what is wrong.

    I also looked at the built-in admin templates and it looks to me that there are almost no validations across several admin pages though.

    What would be the best way to do client form validation? Any good library that works well with nodebb would you like to recommend?

    Thanks in advance.


  • Admin

    What errors do you see when you add a validation library?



  • I have several number and string fields in my plugin-rendered page through a custom template edit_info.tpl.
    Everything is working fine and wanted to add some validations for the fields before submitting.
    What would be the best way to achieve this?


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.