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 ...
user avatar
  • 8,764
13 votes

How to remove jQuery Conflict in prototype.js with 1.8.2.jquery.min.js

In your local.xml: <reference name="head"> <action method="addJs" name="jquery" as="jquery"> <script>jquery-1.10.2.js</script> </action> <action ...
user avatar
  • 3,232
10 votes
Accepted

What are the advantages to magento using Prototype

Aside from jQuery being lightly adopted during the development of Magento we must consider another aspect: Magento was developed around 2007 at a time when TC39 was proposing EcmaScript 5 and it was ...
user avatar
  • 35.6k
6 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' ...
user avatar
  • 173
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 ...
user avatar
4 votes
Accepted

Magento undefined jquery

Create a new .js file for eg. no-conflict.js and add the following content on it: var $j = jQuery.noConflict(); And include your no-conflict.js just after your <action method="addJs"><...
user avatar
4 votes
Accepted

How to add addition script to existing validation class

Here's a way that should work and no need to modify a core JS file. Just drop it into a custom JS file and ensure it's included after validation.js. Validation.add('validate-password', 'Please enter ...
user avatar
  • 1,952
4 votes
Accepted

Need help in add to cart with ajax

I tried some thing and it is working fine for me, i am sharing code hope this might be useful for someone else or one can suggest me the better approach. In mage\app\design\frontend\your-design-...
user avatar
  • 163
4 votes

Do not allow comma or point on input text

Add a class called "validate-digits" to your input type text line in the form.bascially it will look like <input type="text" class="(your_other_classes) validate-digits" /> for more validation ...
user avatar
4 votes

Parsing data from template to controller using Prototype JS Ajax.Request

http://prototypejs.org/learn/introduction-to-ajax new Ajax.Request('/some_url', { method: 'post', parameters: {company: 'example', limit: 12} }); Use Google more. There are many examples.
user avatar
  • 388
4 votes
Accepted

Parsing data from template to controller using Prototype JS Ajax.Request

You need form param serialize, and send form fields as it as param to ajax request new Ajax.Request(url,{ method:'POST', parameters:params, requestHeaders: {Accept: 'application/json'}, ...
user avatar
  • 75.6k
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"]');
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/...
user avatar
  • 837
3 votes

How to remove ajax loader in my code

I used the below Code & its Done Element.hide('loading_mask_loader');
user avatar
3 votes

What are the advantages to magento using Prototype

If you know how to code with Prototype you might want to continue using it since it won't make you struggle with compatibility between JS libs. If not, the struggle now is not that complex since ...
user avatar
  • 7,303
3 votes

Error in Prototype.js

I had exactly the same issue. In order to fix this issue you just have to add the js/script.js file in the head block in your layout and before adding the js/wishlist.js file, it would be something ...
user avatar
  • 31
3 votes

Ajax request disable modal / loading-mask

found the answer, to unregister the varienloaderhandler new Ajax.Request('<?php echo $this->getUrl('adminhtml/notification/check') ?>', { //parameters: {isAjax: 'true', form_key: ...
user avatar
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 ...
user avatar
  • 146
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, ...
user avatar
  • 65
3 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?
user avatar
  • 31
2 votes

Confirm age before entering a category

If you want to bail out from already opened catalog you want to use template/catalog/product/list.phtml and template/catalog/product/new.phtml If you want to do it correctly, i.e. BEFORE opening the ...
user avatar
  • 3,405
2 votes
Accepted

Prototype and IE8 document mode

The issues in IE 9 were not due to the release of Prototype 1.7. They were due to incompatibles IE 9 had with the existing versions of Prototype used by Magento at the time. The quick and easy ...
user avatar
  • 7,296
2 votes

WYSIWYG TinyMCE Editor Integration

You will need to include the wysiwyg javascript files. I think the lines of code you need are. <script type="text/javascript" src="<?php echo $this->getJsUrl() ?>tiny_mce/tiny_mce.js">...
user avatar
2 votes
Accepted

Magento : TypeError: source is not an object properties = Object.keys(source);

Found an answer Add <action method="addItem"><type>skin_js</type><name>js/scripts.js</name></action> in your theme layout(page.xml) will resolve this issue
user avatar
2 votes

Prototype keep checkbox selected after page reload

Without any code samples to start from I'm just guessing at what you mean. Did you try anything yet? if (window.sessionStorage) document.observe('dom:loaded', function() { var checkbox = $('id-...
user avatar
2 votes

Check customer email is already exist in magento using ajax prototype

I would try returning the json response like this: $status = "PASS"; $jsonStatus = 200; $info = array( "status" => $status); $this->getResponse()->setBody(json_encode($info))->...
user avatar
2 votes

Documented way of removing prototypeJS with Jquery and fix the ajax search and 1 page checkout?

You can't just replace prototype.js. I know it's hard to hear, but it's just not possible. All core modules are built on Prototype - this means all of the js window objects - bundle, product, etc. ...
user avatar
  • 35.6k
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 ...
user avatar
  • 195k
2 votes

What part in the OPC captures json response from the step functions?

When saveBillingAction() call the json capture the layout handler and generate html from layout Just goto Mage_Checkout_OnepageController and check at saveBillingAction function and on the function,...
user avatar
  • 75.6k
2 votes
Accepted

Coupon code form and show div onSuccess / onFailure

To hide the element with delay Element.hide.delay(3, 'element-id'); here first parameter is time interval(i.e., right now 3 seconds) and second is element id. To hide your divs after AJAX Success $...
user avatar

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