Skip to main content
25 votes

How to pass variable to external js in magento 2

There are two ways to include javascript from the template in Magento 2: the <script type="text/x-magento-init"> and the data-mage-init attribute. Either way can be used to pass data to the ...
Aaron Allen's user avatar
  • 9,009
7 votes

Custom form Validation - Magento

There are a lot of classes for data validation: 'validate-no-html-tags' => 'HTML tags are not allowed' 'validate-select' => 'Please select an option.' 'required-entry' ...
Javi Ps's user avatar
  • 183
5 votes
Accepted

Modify existing prototype js validation method

Here is how you can either override an existing validation method or create your own. There is only one js snippet below bc its the exact same procedure for either one. In my example, I override an ...
Shawn Abramson's user avatar
4 votes

How to extend admin js in magento 2 by mixins

I am curious to know why would Magento won't allow using mixins on such file... any quick explanation about it?
Ezri's user avatar
  • 41
4 votes
Accepted

How to extend admin js in magento 2 by mixins

You may not use js mixin for the particular js file you try to override (i.e /vendor/magento/module-sales/view/adminhtml/web/order/create/scripts.js). Also, your require-config.js declaration is ...
Pritam Biswas's user avatar
4 votes

magento 1.9.3.2 backend reset password error

I just fixed the problem for my project. For me this looks like strange behaviour of the return Content-type header. My solution is just to patch "app/design/adminhtml/default/default/template/...
ceckoslab's user avatar
  • 837
3 votes
Accepted

Dynamic text in prototype field validation

I know it's a bit backwards, but you can access the Validation object inside your validation method and then modify it dynamically while you run your test. What you can do is for example, add a new ...
Hydde87's user avatar
  • 146
2 votes
Accepted

How can i upload a file using prototype js ajax call

You cannot sent files via AJAX calls (at least not on all browsers), but you can simulate an AJAX call and upload a file without a page refresh. You can take a look at how the category image is ...
Marius's user avatar
  • 198k
2 votes

Magento1 Feefo widget js conflict with prototype.js

We had the same error. Seems Feefo is not compatible with the default prototype 1.7 which is included in Magento v1. You could show the widgets using iframes (this may scupper the SEO potential) or ...
Jon Holland's user avatar
2 votes

How to extend admin js in magento 2 by mixins

Actually, there is another way to extend a class method that worked for me. Example: scripts-mixins.js define([], function () { 'use strict'; if (typeof AdminOrder !== "undefined") {...
Mykhailo Shatilov's user avatar
2 votes
Accepted

What stopObserving() function is used for - Magento 1.9

Say you have a form input where you are observing the keyUp event. If you wanted to no longer listen to this event, maybe because the value passes validation or is no longer required to validate due ...
Brett's user avatar
  • 1,854
1 vote

I want to override js function on shipping method section

skin/frontend/{package}/{theme}/js/opcheckout.js //shipping method
PЯINCƎ's user avatar
  • 11.7k
1 vote

I want to override js function on shipping method section

shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js somewhere at 591 ...
Konrad Siamro's user avatar
1 vote

Ajax.Responders.register's onComplete Executes Before Ajax Complete

onSuccess is not available for Ajax.Responders http://api.prototypejs.org/ajax/Ajax/Responders/ You need to use onComplete and add some extra checks for url and response status Your code can looks ...
DmitryFurs's user avatar
1 vote

jQuery conflict in owlcarousel

If you use a variable $k, then all of your jQuery calls would be with that object. You can use below example of code. You have to modify according your requirements: <script type="text/javascript"...
Deep Zalavadiya's user avatar
1 vote
Accepted

jQuery conflict in owlcarousel

You can add local copy of jquery after following line[skin/frontend/yourpackage/yourtheme/js/jquery.min.js] <action method="addJs"><script>mage/translate.js</script></action> <action ...
Sohel Rana's user avatar
1 vote

Uncaught SyntaxError: return 32 - new Date(year, month - 1, 32).getDate();

I don't think you can call the getDate() method directly after the Date constructor. I would replace: return 32 - new Date(year, month - 1, 32).getDate(); With: var myDate = new Date(year, month - ...
Raphael at Digital Pianism's user avatar
1 vote
Accepted

Jquery conflict with elastislide.js and prototype.js

If you use a variable $k, then all of your jQuery calls would be with that object. You can use below code: <script type="text/javascript"> $k = jQuery.noConflict(); $k(document).ready(function(...
Deep Zalavadiya's user avatar
1 vote
Accepted

How to scroll to first error in Magento 1.9 product page?

Edit product template: /app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/catalog/product/view.phtml find: <script type="text/javascript"> //<![CDATA[ var ...
Kaziko's user avatar
  • 51
1 vote

Dynamic text in prototype field validation

The easiest way to do this is to add the custom validation in the phtml <div class="validation-advice" id="field-required-entry-[inputID]" style="display:none;">Please enter a value for [...
user4447826's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible