Problem/Motivation
Steps to reproduce:
- Install and enable quicktabs 7.x-3.x-dev
- Go to
admin/structure/quicktabs/add
- Click on the 'Add tab' button at the bottom of the form
- The table should look like screenshot 1, i.e. 'Tab content' and 'Operations' columns are properly displayed
- Make sure that at least one of the tab titles is empty so the form won't validate
- Click on the 'Save' button
Expected result: 'Tab content' and 'Operations' columns should still show up like on screenshot 1.
Actual result: 'Tab content' is empty and 'Operations' is not styled, as displayed on screenshot 2.
Proposed resolution
The problem is that:
- The content of 'Tab content' is updated by using $('#quicktabs-form') in the js
- The styles of 'Operations' is updated by using '#quicktabs-form' in the css
- Drupal changes the form ID from 'quicktabs-form' to 'quicktabs-form--2' when it is udpated with Ajax - see
drupal_html_id()
The problem could be fixed by using a form class (.quicktabs-form) instead of the form ID (#quicktabs-form and #quicktabs-form--2).
Such solution is implemented in the patch provided at #1.
Remaining tasks
Reviews and tests are welcome.
The following issue might be related, though the 'Operations' column does not seem to be affected: #1589832: Content tabs chose block not showing on edit tab interface
Comments
Comment #1
fengtanHere is the suggested patch
Comment #2
dooug commentedI couldn't replicate with the latest 7.x-3.x-dev
--- UPDATE ---
I was able to replicate. I started your steps from scratch and noticed that the form ID is incremented like so "quicktabs-form--4". Which is the real problem here, changing the CSS and JS to use a class instead of the ID doesn't solve the base problem.
It seems to be incremented when I add another tab and save the invalid form. I spent a while trying to understand this. Something about how the form is rebuilt with the new form elements isn't right... maybe the "num_tabs" should be in $form_state['values']['num_tabs'] ? IDK, I'm in over my head: https://api.drupal.org/api/drupal/includes%21form.inc/function/drupal_bu...
Comment #3
smustgrave commentedHas anyone had a chance to test this?
Comment #4
smustgrave commented