Needs work
Project:
Drupal core
Version:
main
Component:
javascript
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Jun 2012 at 01:10 UTC
Updated:
26 Nov 2018 at 11:41 UTC
Jump to comment: Most recent
It would be great if direct links to a vertical tab fieldgroup were possible. At the moment a link to www.example.com/node/11/edit#group_fieldgroup_name brings you to the edit form but the default vertical tab (tab 1) is always selected. The desired behavior is that the edit form would open with the specified vertical tab selected.
Note: This functionality currently exists in the D6 Vertical Tabs module (see http://drupal.org/node/376293)
Comments
Comment #1
nod_This needs to be fixed in 8.x first, then backported to 7.x
Comment #2
clutherMaybe this needs to be recategorized as a bug or documentation request. Looking through vertical-tabs.js I discovered the following:
So maybe the feature is already in there and I'm just not using it correctly. But I could not find any specific documentation. So far I've tried calling using the fieldgroup name, and the human readable name. I looked for a specific CSS ID, but none existed.
Regards,
Chris
Comment #3
nielsvoo commentedHello Cluther,
I figured it out, sometimes the things you are looking for are actually quite simple. When i opened the source of the page containing the vertical tabs i noticed that the tab has an ID generated by Drupal 7, this is the one needed to point to your favorite tab.
For example your tab group name is group_mytab then your link should be:
http://www.yourdomain.com/yourpage/edit#edit-group_mytab
I hope it will work for you too...
Niels
Comment #4
jpstrikesback commentedJust to update the ticket, the above works, the fieldsets are the elements which contains the IDs to target. Thanks Nielsvoo!!
Comment #5
earwax commentedJust to update, the above above does *not* work for horizontal tab groups.
This is true for horizontal tab items, as well, but creating a link to it goes back to the original problem of just linking to the default horizontal tab item (#1). If you want to go to horizontal tab item #2 or #4, then you are S.O.L
Maybe this works for vertical tabs, but it does not work for horizontal tab groups and items. Maybe they will fix this in Drupal 11.0
Comment #6
rmathew commentedI don't believe this should have been closed. Cluther already pointed out that you can link directly to a vertical tab group in the initial issue report. The problem is that the first vertical tab is always selected.
As cluther said, www.example.com/node/11/edit#group_fieldgroup_name already works - but we want www.example.com/node/11/edit#group_vertical_tab_name
Comment #7
playfulwolf commentedThe original problem still persists and #3 trick does not solve that for me for vertical tabs. I am using Fieldgroup module, so this may be the case, but horizontal tabs are working great.
Comment #8
anouHello,
I'm using vertical tabs in D7 in a custom admin form.
I've manage to get the right tab to be opened onload with the ID of the corresponding fieldset.
e.g.: http://mydomain.com#ID_of_the_FIELDSET_of_my_desired_TAB_to_be_openned
Comment #9
ldegoursac@gmail.com commentedI'm not sure if everyone has gotten horizontal tabs inside of tab groups to work, so I am posting here in case it helps.
I am able to open a form directly to any horizontal tab, even one inside of a tab group, using the anchor #tab-id on the end of the edit url. To make it work, I first had to manually set a tab id for each tab, in the content type settings at :
http:///admin/structure/types/manage/
On that settings page, click the gear that is on the same line as the tab. Here, you should see an "id" field that is blank. Enter a unique id such as "my-tab-id", and then save the content type settings form.
After doing this, I could go directly to a horizontal tab that was part of a group, just by adding #my-tab-id to the end of the node edit url.
Comment #11
elijah lynnI am experiencing that the group name does work but since it targets the fieldset and not neccesarily the vertical tab then the vertical tab doesn't show it is selected.
However, if I use the label name of the vertical tab with the + sign instead of spaces or spaces then it does link to the vertical tab.
#edit-group_images (with a label of 'Party Pics') (links to the fieldset, no vertical tab selected
#Party+Pics (links to the vertical tab, vertical tab is selected)
#Party Pics (links to the vertical tab, vertical tab is selected)
However, if I don't use the correct case it doesn't work.
#Party pics (does not work)
The problem with the latter is that when there is an Ajax callback for a "add another/more" button. When it returns it jumps to the current window.location that is set. It doesn't appear to do this with the former example with the fieldset group name but again the disadvantage is that it doesn't show the vertical tab as selected, which is a UX disadvantage.
Comment #12
elijah lynnComment #13
elijah lynnThere is a patch in #376293: Activate current vertical tab from URL fragment for Drupal 7 that updates the window.location (URL bar) with the vertical tab hash.
Update: actually, it is #2752511: Update location.hash when clicking a vertical tab.
Comment #19
RumyanaRuseva commentedAs noted in previous comments, this works perfectly with Vertical Tabs in D8 if you put the correct id in the hash. You can also change the Tab group id in the display settings.
If there is an issue with horizontal tabs, it should be reported in Field Group.
I believe this issue should be either Closed (works as designed), or changed to Drupal 7 if a bug exists there. I have not tested, but I guess it works in D7 as #376293: Activate current vertical tab from URL fragment was implemented in D6.