Fieldsets rendered by Vertical tabs are shown under the submission buttons

kiamlaluno - November 7, 2009 - 14:15
Project:Vertical Tabs
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

The fieldsets are rendered under the buttons, as it is clearly visible in the screenshot.
To notice that Nodewords code calls system_settings_form() for the form being shown.

AttachmentSize
Voila_Capture_52.jpg37.69 KB

#1

Dave Reid - November 7, 2009 - 14:35

I think the vertical tabs fieldset has a weight of 100, so increasing the weight of your buttons should do the trick. Edit: It doesn't have a weight, but because it's added in a form_alter, you just need to make sure your buttons have *some* kind of weight (like 10) because the buttons added with system_settings_form() do not have weight values.

#2

Dave Reid - November 7, 2009 - 14:41
Status:active» fixed

Since this is a problem with any kind of form_alter() and adding elements, marking as fixed since solution was provided.

#3

kiamlaluno - November 7, 2009 - 15:03

I tried using a weight of 100, and 150 for both the buttons, but it didn't help.
I also used 5, and 10, with the same result reported before.

Could not the problem be because there aren't form fields, outside the fieldsets?

#4

Dave Reid - November 7, 2009 - 15:23

Try

  $form = system_settings_form($form);
  $form['buttons']['#weight'] = 100;
  return $form;

#5

kiamlaluno - November 7, 2009 - 15:36
Category:bug report» support request

Thank you for the suggestion; setting the weight as you suggested worked.

I am sorry for having bothered you with such a silly problem.

#6

Dave Reid - November 7, 2009 - 15:42

No worries. It's too bad that core doesn't include a weight in $form['buttons'] with system_settings_form since I don't people want the save buttons to be in the middle of a form ever.

#7

kiamlaluno - November 7, 2009 - 16:02

I agree. In many situations, it would be better to have a weight for the buttons added from system_settings_form(); this is particularly true for forms that are modified from other modules.

Just a silly thought: could not vertical_tabs_add_tabs() have an argument to optionally change the weight of the buttons? I know it is exactly something that Vertical tabs should take care of (and I already said, this is a silly thought), but that would avoid to have duplicated code in all the modules that use Vertical tabs. It would not resolve the problem for all the modules, but at least it would resolve the problem for a group of modules.

#8

hefox - November 7, 2009 - 16:10
Category:support request» bug report
Status:fixed» active

I hate marking a topic back to active from fixed, sorry! :(

It's happening on a node_form I have with a pretty fresh install of drupal (ie no custom modules, few contrib, until I added a costume module to fix the weight of the buttons). Perhaps the patch to fix the cck re-ordering has made this more likely?

node_form buttons don't have a weight (the array; individual buttons do).

Perhaps instead of

<?php
  $form
['vertical_tabs']['#weight'] = 100;
?>

in uses instead the max weight of the fieldsets? Not sure if that'd solve it but may be less likely to.

#9

kiamlaluno - November 7, 2009 - 16:22

Did you try changing the code as suggested to me? If it worked in my case, it could work in your case too.

#10

Dave Reid - November 7, 2009 - 16:25

@KiamLaLuno: It'd be impossible to know which buttons it should and should not move. There is a valid case for buttons being in the middle of a form, as well as inside form elements, like the system_settings_form buttons.

@hefox: Technically that's different from what this report was about, but still a valid point. I've been working on code to remove that hard-set weight on the node form.

#11

Dave Reid - November 7, 2009 - 16:59
Status:active» fixed

Ok just removed the hard-coded weight on the node forms. It now should calculate what weight the vertical tabs element should be. If it tabifies fieldsets with weights of 0, 5, and 20, it will assign itself a weight of 20.

#12

System Message - November 21, 2009 - 17:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.