I've encountered this issue on two separate Drupal sites, and on two different screen.

When loading a page that contains an HS select list, the message "You don't have Javascript enabled" flashes on the screen momentarily before the page finishes loading. After the page has completely loaded, this message disappears and everything works as expected. Clearly, the duration of this message depends on how long the page takes to load.

Is there anyway to prevent this? Perhaps using jQuery's $(document).ready() function to check for javascript only after page load? Maybe changing the module weight?

Any suggestions would be appreciated. Thank you.

Comments

garciac1212’s picture

I have this same problem and it's kind of annoying. I love the HS feature but that message "You don't have javascript enabled..." that flashes for a quick second, does not present well for our end users. I thought it was a theme issue but it seems it's a little more complex than that..
Any advice on removing it would be greatly appreciated....

grasmash’s picture

I did end up finding a workaround for this issue, but it may not be applicable to your needs.

The HS menu that I'm using isn't entirely necessary-- I can afford to hide from users who have javascript disabled.

So, I simply created a CSS rule that set "display: none;" for the HS menu block. Then, I added a line of jQuery that will switch the CSS to "display: block;".

This way, users with javascript enabled see the block correctly (no flash of error) and users without won't see the menu at all.

Not a fix by any stretch, but it suited my purposes.

Pete B’s picture

I changed the function _hierarchical_select_nojs_helptext as follows:

function _hierarchical_select_nojs_helptext($dropbox_is_enabled) {
  $output = '<script type="text/javascript"></script><noscript>';

  // The options that will be used in the unordered list.
  $items = array(
    t('<span class="highlight">enable Javascript</span> in your browser and then refresh this page, for a much enhanced experience.'),
    t('<span class="highlight">click the <em>Update</em> button</span> every time you want to update the selection'),
  );
  $items[1] .= (!$dropbox_is_enabled) ? '.' : t(", or when you've checked some checkboxes for entries in the dropbox you'd like to remove.");

  $output .= '<span class="warning">';
  $output .= t("You don't have Javascript enabled.");
  $output .= '</span> ';
  $output .= '<span class="ask-to-hover">';
  $output .= t('Hover for more information!');
  $output .= '</span> ';
  $output .= t("But don't worry: you can still use this web site! You have two options:");
  $output .= theme('item_list', $items, NULL, 'ul', array('class' => 'solutions'));
  $output .= '</noscript>';

  return $output;
}

I put an empty script tag, followed by a noscript around the entire helptext. This means that the help text is only loaded if you don't have javascript.

Pete B’s picture

In fact, for the full effect, you can do it higher up: (hierarchical_select.module around line 664)

  // This button and accompanying help text will be hidden when Javascript is
  // enabled.
  $element['nojs'] = array(
    '#prefix' => '<script type="text/javascript"></script><noscript><div class="nojs">',
    '#suffix' => '</div></noscript>',
  );

So that you never see the update button either.

chinita7’s picture

Thanks #3 works for me.

kars-t’s picture

Status: Active » Fixed

Dear fellow Drupal enthusiasts,

this issue is now lasting for a very long time in the issue queue and was unfortunately never solved. As Drupal is a open source project everyone is helping on voluntary basis. So that this is was not solved is nothing personal and means no harm. But perhaps no one had time to deal with this issue, maybe it is too complex or did not describe the problem comprehensibly.

But this issue is not the only one. There are thousands of issues on Drupal.org that have never been worked on or could not be processed. This means that we are building a wave that is unmanageable and just a problem for the Drupal project as a whole. Please help us keep the issue queue smaller and more manageable.

Please read again, "Making an issue report" and see if you can improve the issue. Test the problem with the current Core and modules. Maybe the problem doesn't exist anymore, is a duplicate or has even been solved within this issue but never closed.

Help can also be found for it on IRC and in the user groups.

In order to remove this issue, I have set this issue to "fixed"

If there is new information, please re-open the issue.

Status: Fixed » Closed (fixed)

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