Jump to content

Override js file


Recommended Posts

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...