psbruce Posted January 21, 2017 Share Posted January 21, 2017 I want to alter one of the form validation methods contained in js/validate.js. Where would I place the override file? I can't find any info on overriding js files. Is it possible to override only the method that I want to change - ie I don't want to override the whole js file. I am looking for a way to extend validate.js (similar to the way of overriding classes or controllers) if that is possible? Any assistance with this would be much appreciated. Link to comment Share on other sites More sharing options...
joseantgv Posted January 23, 2017 Share Posted January 23, 2017 I want to alter one of the form validation methods contained in js/validate.js. Where would I place the override file? I can't find any info on overriding js files. Is it possible to override only the method that I want to change - ie I don't want to override the whole js file. I am looking for a way to extend validate.js (similar to the way of overriding classes or controllers) if that is possible? Any assistance with this would be much appreciated. Check this http://stackoverflow.com/a/33857893/1136132 Link to comment Share on other sites More sharing options...
psbruce Posted January 23, 2017 Author Share Posted January 23, 2017 Thanks so much. This is very interesting. It seems that in order to use the workaround for a js override method in http://stackoverflow.com/a/33857893/1136132, one would need to also change the .tpl file to refer to the new validation function in the new js file? Is that correct? Where would I put the new js file containing the override method so that Prestashop would find it? Link to comment Share on other sites More sharing options...
joseantgv Posted January 23, 2017 Share Posted January 23, 2017 Thanks so much. This is very interesting. It seems that in order to use the workaround for a js override method in http://stackoverflow.com/a/33857893/1136132, one would need to also change the .tpl file to refer to the new validation function in the new js file? Is that correct? Where would I put the new js file containing the override method so that Prestashop would find it? You could create a module and then add the new JS in the hookHeader. You could also edit tpl to add this new JS. Link to comment Share on other sites More sharing options...
psbruce Posted January 23, 2017 Author Share Posted January 23, 2017 Thanks so much - I will try that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now