Hi all,

I've noticed that, using Vertical Tabs module, a "null" word appear before the selected item.

Please see image in attachment that show the issue

Thank you

MXT

Comments

wim leers’s picture

Title: Word "null" appearing with Vertical Tabs » HS Taxonomy + Vertical Tabs compatibility: "null" appearing in front of currently selected term
Project: Hierarchical Select » Vertical Tabs
Version: 6.x-3.0 » 6.x-1.x-dev
Component: Code - Taxonomy » Code

Hm … It seems Vertical Tabs is somehow retrieving the current value using JS. Their JS seems unable to handle HS. Moving to the Vertical Tabs issue queue, so they can pinpoint the code that does this. Then they can move it back to the HS issue queue and I'll work on a patch.

dave reid’s picture

Vertical tabs only supports the core taxonomy forms and widgets. If a module (like HS) changes the fields/inputs, it can override the summary JavaScript. This is what Pathauto currently does:

function pathauto_form_alter(&$form, $form_state, $form_id) {
  // Process only node forms.
  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
    ...
      // Override path.module's vertical tabs summary.
      $form['path']['#attached']['js']['vertical-tabs'] = drupal_get_path('module', 'pathauto') . '/pathauto.js';
  }
}
wim leers’s picture

So Vertical Tabs does *not* use JS magic for this at all then?

dave reid’s picture

The only JS magic it uses is JS that will pull data from the core taxonomy module form elements. Again, if modules like HS change or modify the way taxonomy data is input, then the modules are responsible for overriding the vertical tabs JS.

wim leers’s picture

Project: Vertical Tabs » Hierarchical Select
Version: 6.x-1.x-dev » 6.x-3.x-dev
Assigned: Unassigned » wim leers

Oh, I had misread the code, it's actually adding *JS*, and not setting a hardcoded value. My bad. Thanks Dave! :)

Back to the Hierarchical Select issue queue now.

Nick Robillard’s picture

Subscribing...

wim leers’s picture

Assigned: wim leers » Unassigned
Category: bug » feature
Priority: Normal » Minor

Somebody who wants this should roll a patch! :)

Renee S’s picture

StatusFileSize
new765 bytes

I've rolled a quick and dirty patch for this, an addition to the core/taxonomy.js file already in Vertical Tabs. I did it that way rather than adding a whole other kludge in HS for simplicity's sake if nothing else - it's on the same fieldset form and it's taking care of looping through the taxonomy terms as they're set, already.

Basically, if the label is null, it checks up a level to see if there's a label there instead - because the only difference between the forms is that HS adds an extra DIV.

Renee S’s picture

Status: Active » Needs review
alexpott’s picture

StatusFileSize
new2.38 KB

Here's a patch to fix this issue in the way suggested by #2 i.e in the hierarchical select module and not vertical tabs.

It uses the same js modification as #8 but also checks if the hierarchical select value is none and will ignore the label if this is so.

Renee S’s picture

[Edited] Ok, #10 works in some circumstances, but not all.

* It works perfectly if the HS vocab being used has "save term lineage" checked, and "Reset selection" is disabled.
* For vocabs with "save only deepest term" and "reset selection" enabled, it seems to work when you click on an item initially, but then the label on the Vertical Tab disappears entirely as soon as you click Add and it doesn't come back.
* For vocabs with "save only deepest term" and "reset selection" disabled, it seems to work when you click on an item initially, but then the label on the Vertical Tab only represents the last selected item and each new selection clears the list and puts itself on it alone.

wim leers’s picture

Status: Needs review » Needs work

As per #11, marking as needs work.

Thanks for the review, renee! :) And thank you for the work, alexpott!

alexpott’s picture

And thank you for the amazing module, Wim!

wim leers’s picture

I don't have time to work on this patch, but if you can, please fix the remaining problems with it, I'd love to commit this!

alexpott’s picture

StatusFileSize
new3.28 KB

Here's a effort at tackling the issues brought up in #11

Basically the change event is not firing when hierarchical select taxonomy is reset (the highest level is set to none). This patch uses the change-hierarchical-select trigger which is fired when this occurs to reset the vertical tabs summary text when the value is set to "none".

alexpott’s picture

StatusFileSize
new3.31 KB

... and now the patch copes with label levels...

alexpott’s picture

And now to work on what happens when hierarchical select's dropbox is enabled... needs to work in a completely different way :)

alexpott’s picture

StatusFileSize
new6.45 KB

And now with dropbox support... just need to tidy up the code and add a few comments to explain.

wim leers’s picture

Great progress, Alex! :) Thank you very much for your efforts! Looking forward to reviewing this patch!

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new7.93 KB

Patch with added comment goodness!

I've also moved the binding of a function to the change-hierarchical-select event from document.ready to a behaviour so if hierarchical select forms in vertical tabs are added through ajax this all should still work.

betz’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm this patch works.
Thanks alexpott!

ñull’s picture

Status: Reviewed & tested by the community » Needs work

I am using hs for core taxonomy (no cck). Before null and other undesired information was appearing in the summary. After applying the patch nothing is appearing. Please correct me if I am wrong, but from the other comments here I guess that this was not the intended function of this patch.

betz’s picture

Status: Needs work » Needs review
StatusFileSize
new53.85 KB

@ñull have a look at the screenshot (attachment)
Are you sure you selected some terms?

ñull’s picture

Status: Needs review » Needs work
StatusFileSize
new90.2 KB

See attached screen shot. I tried to go back to Garland theme, but that did not make a difference.

betz’s picture

i also enabled the dropbox feature like on your screenshot, same result.
Can't reproduce your issue.
What version of vertical tabs are your running?

alexpott’s picture

StatusFileSize
new10.15 KB

I thought this might be because of the multiple dropboxes as I hadn't tested it under that scenario. However for me it works just fine too... see attached screenshot. @ñull are you getting any javascript errors?

ñull’s picture

I will try it on a clean Drupal. Must be some influence of the multiple modules I have installed on this site.

bartezz’s picture

subscribe...

wim leers’s picture

Status: Needs work » Closed (cannot reproduce)

Thanks, #26! :)

alexpott’s picture

Hi Wim,

Did this ever get committed?

ayalon’s picture

Status: Closed (cannot reproduce) » Needs review

I think not?

vlooivlerke’s picture

Hi this patch works if you have more than one taxonomy in your node form, but if you only have one taxonomy it does not work.

bartezz’s picture

@vlooivlerke; a single taxonomy isn't put into a vertical tab by default anyway since a single taxonomy doesn't have a surrounding fieldset. I solve this in my case via a custom module;

function MYMODULE_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'page_node_form':
      // put single taxonomy select/input inside a fieldset on a node edit form so it can be vertical tabbed
      if($form['taxonomy']) {
        $form['taxonomy']['#title'] = t('Categories');
        $form['taxonomy']['#type'] = 'fieldset';
      }
    }
  }
}

You'll need to do this via a custom module, if you don't know how to create one, please check; http://drupal.org/node/231276

Cheers

vlooivlerke’s picture

Thanks :) #33
That's great.

dyke it’s picture

patch in #20 works perfectly! thanks a lot alexpott!!!

summit’s picture

Status: Needs review » Reviewed & tested by the community

Hi,
I think this patch #20 is ok to set to RTBC, right?
Greetings, Martijn

stefan.r’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)