2

We're using vertical tabs on a configuration form for a ctools content type inside Panels. Inside most of these vertical tabs, there are "Add more" buttons, which use AJAX to add another item to the form. Essentially combine these two examples:

https://api.drupal.org/api/examples/vertical_tabs_example!vertical_tabs_example.module/7

https://api.drupal.org/api/examples/ajax_example!ajax_example_graceful_degradation.inc/function/ajax_example_add_more/7

We set the container around the whole form to reload the entire thing. The problem is that, on reload, the vertical tabs reset. We'd prefer it leave the element that the user currently had open open. Is there a way to do that?

  • you would need to use cookies so it remembers what was opened. – No Sssweat Jun 3 '15 at 21:07
  • by remembers I mean the cookie would store the url that needs to be opened when page refreshes. – No Sssweat Jun 4 '15 at 16:56
0

We can save in $form_state html id current vertical tab. Only, be sure, do not forget to set custom ids your tabs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.