Problem/Motivation
When jQuery is updated to, say, 1.6.x..
i got the title's problem when i try to create a new field.
The problem is that i select a new field name, then the type and i'd like to select the widget, but i cant because the input select it's like locked. i mean i cant click on the widget select, and if i save i get:
Add fieldname field: you need to select a widget
Original thread: http://drupal.org/node/1230142
Proposed resolution
In my point of view jquery update change the behavior of empty string. So here a patch
Index: modules/field_ui/field_ui.js
===================================================================
--- modules/field_ui/field_ui.js
+++ modules/field_ui/field_ui.js
@@ -86,7 +86,7 @@
html += '<option value="' + value + '"' + (is_selected ? ' selected="selected"' : '') + '>' + text + '</option>';
});
- $(this).html(html).attr('disabled', disabled ? 'disabled' : '');
+ $(this).html(html).attr('disabled', disabled ? 'disabled' : false);
});
};
Clément Hurel
Remaining tasks
Patch works for 1.4.x and newer versions of jQuery.
User interface changes
none.
API changes
none.
Original report by cavax
Comment | File | Size | Author |
---|---|---|---|
#3 | 1327440-3.patch | 524 bytes | drzraf |
Comments
Comment #1
marcingy CreditAttribution: marcingy commentedCore does not support jquery 1.6, upgrades to jquery are supported via this contrib module - http://drupal.org/project/jquery_update
Comment #2
EvanDonovan CreditAttribution: EvanDonovan commentedThis would require a replaced Javascript file for field_ui.js as part of jQuery Update for 7.x. Postponing on a release of jQuery Update that provides jQuery 1.6+.
Comment #3
drzraf CreditAttribution: drzraf commentedas per http://api.jquery.com/prop and http://blog.jquery.com/2011/05/12/jquery-1-6-1-released attached a new patch (for makefile users) using prop()
Comment #4
guysung CreditAttribution: guysung commentedThis patch needs to be applied for content.js file in Drupal 6 cck module when you upgraded jQuery in Drupal 6
Comment #5
MurzSame problem with jQuery Update version 7.x-2.x-dev from 2012-Jan-18 and Drupal 7.12. Downgrade to 7.x-2.2 solve the issue.
As alternative, patching Drupal module with drzraf patch from #3 solve the issue without downgrading jQuery Update to 7.x-2.2. Is this patch compartible with older jQuery, that comes with Drupal core? If yes, I think we must move this issue to Drupal core.
Comment #6
Alan D. CreditAttribution: Alan D. commentedFew other related threads, like #1183358: Updating jQuery version breaks "disabled" attribute. As it is a JQuery 1.6+, it can only be applied to Drupal 8 or above, (and it is applied to Drupal 8 core).
So it is not a core issue, just a JQuery Update issue. Effects both D6 / D7, but general policy is to update the higher version and to back port, so re-tagging to 7.x-2.x-dev.
Comment #7
Alan D. CreditAttribution: Alan D. commentedDuh. The module doesn't officially support this JQuery version.
But it does fix the error if you are running a higher version, and I would give it the RTBTC otherwise
Comment #8
_yancg CreditAttribution: _yancg commentedIf like me you don't like applying patches to core modules it can be resolved with a hook. I simply copied the modules/field_ui/field_ui.js file to my custom module, applied the modifications the patch above does and added this to my code.
cheers !
Comment #9
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedthe patch in 3 worked for me
Comment #10
Preston McMurry CreditAttribution: Preston McMurry commentedAlso present in 7.x-2.x-dev, released on 2012-Mar-08 . See thread here: http://drupal.org/node/1538144 . Setting version selector to 1.5 fixed symptom, not disease. It seems it would be an easy fix in code ...
Comment #11
iadefy CreditAttribution: iadefy commentedThe #3 patch only fixed the partial problem, there' still an issue with this patch. For example, in Views->Fields->Create a label, the label field just won't show up...
Comment #12
drzraf CreditAttribution: drzraf commentedFYI, core fixed Sat Jun 23, #1480568: use $.attr with false instead of empty string (bug created march 13th...)
Comment #13
barresoft CreditAttribution: barresoft as a volunteer and commentedHere is a solution: https://www.drupal.org/node/1538144
Comment #14
markhalliwellThis is a jQuery API deprecation issue, which can be resolved using the jQuery Migrate plugin.