Coming from #1669960: Clientside Validation 1.33 fails on IE: older versions of jquery.form.js are breaking clientside_validation on IE < 9

CommentFileSizeAuthor
#2 jquery-form-update-1675794-2.patch85.96 KBdsnopek
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

diggingrelic’s picture

I verify that this is an issue and the fix described in #1669960 works for me.

dsnopek’s picture

Title: Update jquery.form.js to v3.09 » Update jquery.form.js to v3.35 - older versions break in IE8
Status: Active » Needs review
FileSize
85.96 KB

I can verify that version of jquery.form.js currently included in jquery_update breaks in IE8. Here is the offending code:

   var n,v,a = this.formToArray(options.semantic);
        if (options.data) {
                options.extraData = options.data;
                for (n in options.data) {
                        if(options.data[n] instanceof Array) {
                                for (var k in options.data[n]) {
                                        a.push( { name: n, value: options.data[n][k] } );
                                }
                        }
                        else { 
                                v = options.data[n];
                                v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
                                a.push( { name: n, value: v } );
                        }
                }
        }

Notice how it's using for (var k in options.data[n]) to loop over an Array. This will cause it to even include methods and the 'length' property! It should probably have been using a for (var k = 0; k < options.data[n].length; k++) style loop. In any case, this problem is fixed in newer versions of jquery.form.js.

I've attached a patch that includes jquery.form.js version 3.35.

Please let me know what you think!

asvsot’s picture

#2 works fine for me. Fixes IE8 issue.

pandaPowder’s picture

#2 worked for me. I'm a bit worried about breaking some other thing in the vast drupal ocean, but... it fixes my bug so :) I'm going to swap it out!

pandaPowder’s picture

Status: Needs review » Reviewed & tested by the community
markhalliwell’s picture

Title: Update jquery.form.js to v3.35 - older versions break in IE8 » Update jquery.form.js - older versions break in IE8
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

The current version is 3.50.0-2014.02.05: https://github.com/malsup/form/blob/master/jquery.form.js

We should probably update to that and verify nothing breaks before continuing.

markhalliwell’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#2266303: Update jquery.form.js

Actually closing in favor (and dup) of related issue.