24
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 ...
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' ...
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 ...
4
votes
Accepted
getElementsByName doesn't work after admin grid ajax request
instead of
var checkboxes = document.getElementsByName(chkboxName);
try prototype
var checkboxes =$$('#billship input[type="checkbox"][name="invoice_ids"]');
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/...
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?
3
votes
Accepted
prototype window pop up document.observe function error. TypeError: $$(...)[0] is undefined
I modified the popup code, this worked for my needs.
function addNewPop(id,title,w,h){
win = new Window({
title: title,
className:"magento",
destroyOnClose: true,
recenterAuto:false, ...
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 ...
2
votes
Accepted
Check an ajax response is json or else using prototype js
Find a function which is fulfill my requirement.
Function name: isJSON().
just add below two line code and get result
var response = transport.responseText;
if (response.isJSON(...
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 ...
2
votes
Are JavaScript events triggered during the onepage checkout of Magento?
Add the following code in your checkout/onepage.phtml file. This override the core checkout gotoSetion function
Checkout.prototype.gotoSection = function (section, reloadProgressBlock) {
/*For ...
2
votes
Magento 2 - Replace existing Prototype JS with jQuery
First add requirejs-config in Vendor/Module/view/[your_area]/requirejs-config.js
var config = {
map: {
"*":{
MySlider: "YourVendor_Module/js/myslider"
}
},
paths: {
}
}...
2
votes
Accepted
Magento 2 - Replace existing Prototype JS with jQuery
UnderscoreJs library was created when RoR migrate from prototypejs to jquery. You may use it to migrate your scripts. For example Class.create is _.create
2
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 ...
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 ...
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 ...
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") {...
1
vote
Accepted
Remove Conflict between JQuery and Prototype.js in magento 1.9.1
only noconflict.js this will not work you have to replace variable $ with jQuery
add this var jQuery=$.noConflict(); in start of file every jquery related file. and replace every $ with jQuery
1
vote
Remove Conflict between JQuery and Prototype.js in magento 1.9.1
go ahead and add the contents of noconflict.js directly at the end of your jquery file , this will ensure that it gets executed right after jquery is loaded
1
vote
I want to override js function on shipping method section
skin/frontend/{package}/{theme}/js/opcheckout.js //shipping method
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 ...
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 ...
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"...
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 ...
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 - ...
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(...
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 ...
1
vote
Ajax request not working from validation.js
Your Ajax request url should dynamic.
Define a java script which is content request url val at head.phtml
var OtpUrl="<?php echo $this->getUrl('RouteId/process/test')?>";
and call this ...
1
vote
Accepted
Ajax request not working from validation.js
Please update code
['validate-otp', 'Please enter valid OTP.', function(v) {
var url = 'http://127.0.0.1/mage3/index.php/customsect/processing/test?code='+v;
new Ajax.Request(url, {
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
prototype-js × 109magento-1.9 × 40
javascript × 35
ajax × 20
jquery × 18
magento-1.7 × 13
validation × 10
magento-1.8 × 8
form-validation × 7
magento-enterprise × 6
onepage-checkout × 6
conflict × 6
magento2 × 5
checkout × 4
configurable-product × 3
error × 3
admin × 2
extensions × 2
frontend × 2
custom × 2
image × 2
forms × 2
requirejs × 2
php-5.4 × 2
ee-1.13 × 2