Use jquery to show vocabs according to selected group
whyameye - September 30, 2008 - 17:52
| Project: | OG Vocabulary |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
I've done some reading here and it appears that this might be expected behavior, but I would like to confirm: I cannot see the drop-down list of og categories in my group when creating a blog post. If I hit "preview" I still cannot see the list. I can only see the list if I post to the group, then edit the post.
This is a real problem for me as my users need to be required to choose a category/vocab/taxonomy/whatever-the-nomenclature when posting. I have been looking at using rules with tokens to force edit following blog post submission, but that seems awkward and besides I can't get it to work. Any other ideas or am I missing something obvious?
Drupal 6.4

#1
Duplicate #155021: Only one (first) og category is displayed for a node which is beeing submited to several groups.
#2
this isn't a duplicate. What I am saying is that you have to hit "preview" before you can see the vocab for the group you have chosen when you are creating new content. What would be much more intuitive for users in my opinion is if this module used JQuery or AJAX to show the vocabs available for each group at the time the group is chosen, rather after the form is submitted.
#3
Nice idea. A patch is welcomed.
#4
This is really funny since this is the functionality i was actually looking to get into the og vocab module.
Based off this attached is a patch that we currently run for it providing the css, js and updated module patch.
Please let me know if this will meet the needs.
We utilize it so we can attach posts and also things like files directly to the term in the audience from either the add or edit portion in the system. This original code came about due to the need for it in the add portion mostly.
#5
@darren,
Thank you for the patch.
og_vocab.module:
+ $vocabularies = db_query("SELECT nid, vid FROM {og_vocab}");
We don't need *all* vocabs, we just need to get those that are related to this node. So you can use og_vocab_get_vocabularies().
og_vocab.js:
+ if (Drupal.jsEnabled) {
+ ...
+ }
You can use Drupal.Behaviours, so we won't need this part.
btw, can you please re-roll it with the JS and CSS included (not tar) - http://drupal.org/patch/create, so I'll test the code.
#6
The reason behind getting all of them was that if the node has not been created yet then we would like all of the audiences so we can hide and show them as needed. As i said this patch originally was done because we wanted to make sure uploaded files were put into the correct audience and then the blog posting would go to a specific taxonomy based off the audience that was supplied. Hence since the audience is not known in the begining this is why i took all of them in the begining and the jquery will show and hide based off the audience that is selected.