Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Javascript Validation not working in IE 9
 
anoopnath
Jr. Member
 
Total Posts:  14
Joined:  2010-08-27
 

Hi All

I noticed a strange issue with Javascript validation in IE 9,
The form submits even after the validation message is displayed.
I thought it was Magento version issue, but later found out it is an IE bug.

Thanks in advance for all your reply’s

regards
Anoop

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Moderator
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Not sure if this helps:
http://alanstorm.com/ie9_fix_for_magento
At least give a try.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
iRoney
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2010-09-05
 

Works like Charm ...

Thank you saved me tongue wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
aalinn
Member
 
Total Posts:  50
Joined:  2009-05-05
 

The meta tag solution works great, but it causes other issues. Are there any other known resolutions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tangkoko
Member
 
Avatar
Total Posts:  75
Joined:  2008-04-07
France
 

+1
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
anoopnath
Jr. Member
 
Total Posts:  14
Joined:  2010-08-27
 

Hi All
I had a few issues with IE 9 and magento Admin side.
i tried to clear it my own way.
First issue :  Admin Grid’s row on click wont work in IE 9
What i did was , I edited file js\mage\adminhtml\grid.js function rowMouseClick , around line no :: 130

rowMouseClick : function(event){
        
if(this.rowClickCallback){
            try{
                
                this
.rowClickCallback(thisevent);
            
}
            
catch(e){
                
/* Hack */
                
if(event.target.parentNode.getAttribute('title'))
                    setLocation
(event.target.parentNode.getAttribute('title'));
                
}
                
/* Hack  */
            
}
        }
        varienGlobalEvents
.fireEvent('gridRowClick'event);
    
},
Second Issue :: Admin Grid Filtering Wont work in IE 9
What i did was , I edited file js\mage\adminhtml\grid.js function filterKeyPress
filterKeyPress : function(event){
        
if(event.keyCode==Event.KEY_RETURN){
                       
/* Hack  */
            
var browserName=navigator.appName// appName is the browser's name
            
var browserVersion=navigator.appVersion// appVersion is the browser's version
            
if(browserName=="Microsoft Internet Explorer" && browserVersion.search(/MSIE 9.0;/i)){
                this
.doFilterforie9();                
            
else {
                this
.doFilter();
            
}
                       
/* Hack  */
        
}
    }
,
/* Hack  */
   
doFilterforie9 : function(){        
        
var elements [];
        var 
inpelements document.getElementsByTagName("input");
        for ( 
i=0inpelements.lengthi++ ) {            
            
var strid=inpelements[i].getAttribute('id');                
            if(
strid && strid.search("filter")>=0){
                
if(inpelements[i].value && inpelements[i].value.length){
                    elements
.push(inpelements[i]);
                
}
            }            
        }
        
var selpelements document.getElementsByTagName("select");
        for ( 
i=0selpelements.lengthi++ ) {            
            
var strid=selpelements[i].getAttribute('id');                
            if(
strid && strid.search("filter")>=0){
                
if(selpelements[i].value && selpelements[i].value.length){                
                    elements
.push(selpelements[i]);
                
}
            }            
        }
        
if (!this.doFilterCallback || (this.doFilterCallback && this.doFilterCallback())) {
            this
.reload(this.addVarToUrl(this.filterVarencode_base64(Form.serializeElements(elements))));
        
}
    }
,
/* Hack  */
Third Issue :: In Edit Product Page when we click either Category , Related Product Tabs , a blank page appears in IE 9. 
What i did was , I edited file js\mage\adminhtml\tabs.js function tabMouseClick
tabMouseClick : function(event{
        
var tab Event.findElement(event'a');

        
// go directly to specified url or switch tab
        
if ((tab.href.indexOf('#') != tab.href.length-1)
            && !(
Element.hasClassName(tab'ajax'))
        ) 
{
            location
.href tab.href;
        
}
        
else {
            this
.showTabContent(tab);
            
/* Hack */
            
var browserName=navigator.appName// appName is the browser's name
            
var browserVersion=navigator.appVersion// appVersion is the browser's version
            
if(browserName=="Microsoft Internet Explorer" && browserVersion.search(/MSIE 9.0;/i)){
                tab
.href="#";//alert("IE");
            
}
            
/* Hack */
        
}
        Event
.stop(event);
    
},

Iam sharing it here , if someone have better solution , please post.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mledoux
Jr. Member
 
Total Posts:  2
Joined:  2011-02-01
 

Here’s my solution, it’s worked quite well so far: http://www.alexanderinteractive.com/blog/2011/10/solving-the-ie-7-ie-9-magento-prototype-validation-bug/

Hope this helps!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yanith
Jr. Member
 
Total Posts:  22
Joined:  2011-09-21
 

I tried different methods including this one and the custom form kind of works.

when the person hasn’t filled anything, but clicks submit.  the form checks for the fields and displays the validation error. however, the form is sent as an empty email and the thank you page is loaded.

this only happens on the custom form all the other forms are working fine.

I’m suing this for a magento 1.6.1.0 template.

<script type="text/javascript\">
//< ![CDATA[
var rfq = new VarienForm(’eMail’);

//]]>
</script>

also using var rfq = new VarienForm(’eMail’, true);

but neither one works

this is my form tag:

<form id="eMail" name="eMail" method="post" action="<?php echo $this->getUrl('rfq/index/save'); ?>">

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cubix WS
Guru
 
Avatar
Total Posts:  318
Joined:  2009-07-01
LondON, United Kingdom
 
anoopnath - 04 October 2011 12:57 AM

Hi All
I had a few issues with IE 9 and magento Admin side.
i tried to clear it my own way.
...................................................

Thanks anoopnath! You are a rockstar. I hate pesky javascript errors for IE9 and your work resolved my errors.

I put many many hours trying the solutions:
1. The meta tag solution, but it didn’t work
2. Upgrading prototype.js to 1.7. That resolved the errors but caused a lot of new errors everywhere around the website, for obvious reasons that all other javascript files rely on older prototype

So in the end I decided that rather battling with all the unknown errors that got introduced by upgrading prototype, I rather battle the known issues by implementing your solutions, which worked perfectly smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top