I'm running the latest dev version with jQuery 1.7.

If you begin to add a new field, select the 'Field' type, which then usually makes the 'Widget' field available for select. However it stays as 'disabled' and I can't select a value for it.

I selected jQuery V1.5 instead, and it works perfectly.

Comments

paw-e-l’s picture

I needed v1.7 only on the front of the website so i hardcoded v1.5 for the backend ;)

line 79 of the jquery_update.module
replace:

<?php
 
// Replace jQuery with the latest version.
 
$version = variable_get('jquery_update_jquery_version', '1.5');
?>

with:

<?php
 
// Replace jQuery with the latest version.
 
$version = variable_get('jquery_update_jquery_version', '1.5');
  if (
strpos(request_path(), 'admin/') === 0)
     
$version = '1.5';
?>
sylus’s picture

On latest dev of CTools and Views I don't see this issue present itself anymore. Can you verify?

neilhanvey’s picture

This is no longer an issue with the latest version of jquery update. I had the same problem but the update fixed it (although it did produce other errors related to clearing caches)

eiriksm’s picture

#1:

You don't need to hack the module. And you should not hack the module (Are you sure you will remember to update it when you update jq update?)

Anyway. here is my solution:

Create a custom module (or use one you already have). Then just do as follows:

<?php
/**
 * Implementation of hook_library_alter().
 */
function MYMODULE_library_alter(&$javascript, $module) {
 
// Force old jQuery on all admin pages.
 
if (arg(0) == 'admin') {
   
$path = drupal_get_path('module', 'jquery_update');

   
// Make sure we inject either the minified or uncompressed version as desired.
   
$min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min';
   
$cdn = variable_get('jquery_update_jquery_cdn', 'none');

   
$version = '1.5';
   
jquery_update_jquery_replace($javascript, $cdn, $path, $min, $version);
  }
}
?>

Instant win, and no hacks needed.

ressa’s picture

Version:7.x-2.x-dev» 7.x-2.3

Thanks @eiriksm, spot on solution! I couldn't make it work though, so I entered debug($trueversion, ''); in the jquery_update.module line 185, right after $javascript['jquery']['version'] = $trueversion;. The function was called twice on admin pages:

'1.5.2'
in jquery_update_jquery_replace() (line 185 of /srv/www/website/sites/all/modules/jquery_update/jquery_update.module).

'1.8.2'
in jquery_update_jquery_replace() (line 185 of /srv/www/website/sites/all/modules/jquery_update/jquery_update.module).

...leaving 1.8.2 as the used version on admin pages.

So I changed the weight of my own module using the code from this page http://drupal.org/node/110238:

<?php
  $weight
= db_select('system', 's')
              ->
fields('s', array('weight'))
              ->
condition('name', '[the_other_module_name]', '=')
              ->
execute()
              ->
fetchField();

 
db_update('system')
    ->
fields(array('weight' => $weight +1))
    ->
condition('name', '[your_module_name]', '=')
    ->
execute();
?>

And the order is now reversed on admin pages, so version 1.5 is used:

'1.8.2'
in jquery_update_jquery_replace() (line 185 of /srv/www/website/sites/all/modules/jquery_update/jquery_update.module).

'1.5.2'
in jquery_update_jquery_replace() (line 185 of /srv/www/website/sites/all/modules/jquery_update/jquery_update.module).

After reading this I changed the path check in your module to this:

<?php
 
// if (arg(0) == 'admin') {
 
if (path_is_admin(current_path())) {
?>

I hope this solution will be committed at some point, so we don't have to add an extra module in the first place: Allow different version for administrative pages

ericduran’s picture

Category:bug» support
Status:Active» Fixed

This is already fixed in the latest dev version.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.