In Drupal, how do you get the submit button to appear last on a create content form without making the entire form from scratch? I can set the weight of the submit button using code, but it never goes below any custom fields I've created. If I drag a lot of custom fields from the bottom of the form to the top, the submit button only stays below about 5 of the fields and then all the other fields get stacked below it. It feels like the submit button is simply stuck in one position on the screen. How do I fix that?
views:
30answers:
2
+2
A:
In a hook_form_alter():
$form['submitbuttonid']['#weight'] = 100;
But it seems like something is getting in the way. Typically in Drupal the Submit is always last unless something funny is going on.
Kevin
2010-07-20 00:24:37
by 'submitbuttonid', do you mean for me to use that literal text, or to replace it with the actual id? I tried to use the id from the source "edit-submit" but that didn't work.
Dylan West
2010-07-20 14:08:19
What I was trying before I was this:$form['buttons']['submit']['#weight'] = 100;I got that from the output of dsm($form);
Dylan West
2010-07-20 14:09:13
Do a var_dump($form)
Kevin
2010-07-20 14:43:43
A:
Okay, I had just upgraded to the latest version of views and cck. I reverted back to the versions just before that and now the submit button has returned to the bottom of the form. (And a few other niggling errors I never used to have went away)
Dylan West
2010-07-20 20:48:13
Unless you've got a security vulnerability in your current version, or there's functionality you need in the new version, I'd say hold off on upgrading to a new version of a module.
John Fiala
2010-07-21 22:36:29
Well, the upgrade is highlighted in red for a security release, so I assume that means there must be a security vulnerability in my version of the module, but I did upgrade 3 modules back to back: filefield, cck, and views. I suppose I can re-upgrade them one at a time and test to see which one breaks my site.
Dylan West
2010-07-22 13:32:56