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

See http://drupal.org/node/1230142

CommentFileSizeAuthor
#3 1327440-3.patch524 bytesdrzraf
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcingy’s picture

Status: Active » Closed (won't fix)

Core does not support jquery 1.6, upgrades to jquery are supported via this contrib module - http://drupal.org/project/jquery_update

EvanDonovan’s picture

Project: Drupal core » jQuery Update
Version: 7.9 » 7.x-2.x-dev
Component: javascript » Code
Status: Closed (won't fix) » Postponed
Issue tags: -+patch

This 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+.

drzraf’s picture

FileSize
524 bytes

as 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()

guysung’s picture

Version: 7.x-2.x-dev » 6.x-2.0-alpha1

This patch needs to be applied for content.js file in Drupal 6 cck module when you upgraded jQuery in Drupal 6

Murz’s picture

Same 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.

Alan D.’s picture

Version: 6.x-2.0-alpha1 » 7.x-2.x-dev
Status: Postponed » Active

Few 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.

Alan D.’s picture

Status: Active » Postponed

Duh. 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

_yancg’s picture

If 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.

function mymodule_form_field_ui_field_overview_form_alter(&$form, &$form_state, $form_id) {
	if(isset($form['#attached']['js'])){
		if(is_array($form['#attached']['js'])){
			foreach($form['#attached']['js'] as $index => &$js){
				if(!is_array($js) && $js == 'modules/field_ui/field_ui.js'){
					$js = drupal_get_path('module', 'mymodule') . '/field_ui.js';
				}
			}
		}
	}
}

cheers !

SocialNicheGuru’s picture

the patch in 3 worked for me

Preston McMurry’s picture

Also 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 ...

iadefy’s picture

The #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...

drzraf’s picture

FYI, core fixed Sat Jun 23, #1480568: use $.attr with false instead of empty string (bug created march 13th...)

barresoft’s picture

markhalliwell’s picture

Status: Postponed » Closed (works as designed)

This is a jQuery API deprecation issue, which can be resolved using the jQuery Migrate plugin.