The 'markup' 'field' type was a great idea to alleviate the problem of placing text in arbitrary places on a form page.

Unfortunately, there's no simple and reliable way to have a 'markup' fall below the submit button. For exmaple: Our client wants a certain piece of text to follow the form. Right now, no matter how heavy I make it, a markup "field" will still fall just before the submit button.

Another way to conceptualize this request (and maybe a better way) would be to let the creator control the weight of the submit element. One could concievably put the submit at the top of the form, rather than the bottom, e.g. Or even have multiple submits: One at top and bottom. Useful for very long forms, especially in data entry scenarios.

Comments

davemybes’s picture

The submit button can also have a weight (according to the forms API). Hence, you should be able to change its position. However, this can only be done by theming your form. Simply modify the submit element and increase its weight.

Try something like this in template.php (change the number in ...form_50 to the id number of your form):

function phptemplate_webform_form_50 ($form) {
  $form['submitted']['submit']['#weight'] = '10;
  return _phptemplate_callback('webform_form_50', array('form' => $form));
}

For more info, search for "theming webforms" and take a look at a short tutorial I wrote on this.

quicksketch’s picture

This is an interesting request. Perhaps I just never thought of moving the submit button. The big issue here is that all the webform is contained in a fieldset named 'submitted', while the submit button is at the root of the form (and must stay there, since a lot code makes that assumption). incrn8's suggestion will work if you switch it all around... instead of putting the submit button inside the 'submitted' fieldset, move your markup field outside and with a weight large enough to put it below the submit button (like a 10 or 11). So something like

function phptemplate_webform_form_nid-id-here ($form) {
$form['submitted']['component-id-here']['#weight'] = '10';
$form['component-id-here'] = ['submitted']['component-id-here']['#weight'] = '10;
unset($form['submitted']['component-id-here']['#weight']);
return _phptemplate_callback('webform_form_50', array('form' => $form));
}

Where 'component-id-here' is the markup field.

escoles’s picture

Hmm... looks like this problem is solvable in principle with theming. I'm comfortable with that, for the moment, and I'll try it out as soon as I can. That approach might also address another problem that I'm wrestling with, but won't go into here.

That said, I still think it would be useful to have content after the submit button. Maybe a "footer" element like the views pages have would be a less problematic way to address the issue.

quicksketch’s picture

Status: Active » Closed (fixed)
treehacker’s picture

Is this working for webforms 6.3 also?

escoles’s picture

treehacker -- I think you mean weform 3.x. With the current version of Webform, you should be able to create a CCK text field that follows the form. It's not part of the form, per se, but for the use case I was referring to it wouldn't need to be.

I have not done this yet, but keep in mind that with Webform 3.x you can attach webforms to nodes of arbitrary type. So you can create new "webform" content types, as well. That neatly works around a number of issues I've had with webforms over the past several years.

So, if I understand your question correctly, this is basically a non-issue with the most current version of Webform, on D6.

treehacker’s picture

Hi,

yes sorry.. I mean webform 3.x.

I actually just need to move the submit button up because I have a the form a like this:


So I would need to move the input button directly after a fieldset with form components I have and below show the markup components.

bkosborne’s picture

Just to add a bit here - I came across this page while searching to do the same thing. This can indeed be achieved by adding a cck field for the content type and putting its weight heavier than the webform component. A small problem of mine is that I am working with a multipage form and I only want the disclaimer to appear on the last page.

peterx’s picture

D7 using hook-form_alter in the submit code.
I started by adding a weight:
$form['submitted'][$component_key]['#weight'] = '60';
The action line has a weight of 1000 and I set it to 50 but it did not work.
Then I moved the component to the end of the actions list:

$form['actions'][$component_key] = $form['submitted'][$component_key];
unset($form['submitted'][$component_key]);

Messy. Would be nice to have the option to position the action division similar to a page break.

trgreen17’s picture

Issue summary: View changes

The code in comment #1 worked perfectly for me. Thank you @incrn8!

msypes’s picture

You can also do this kind of thing with a form_alter targeting your webform:

$form['bottom_matter'] = $form['submitted']['bottom_matter'];
unset($form['submitted']['bottom_matter']);
$form['bottom_matter']['#weight'] = $form['actions']['#weight']+1;
crutch’s picture

came across this post while trying find a way. In template.php D7, can use #prefix or #suffix - before or after submit button

/**
 * Implements hook_form_FROM_ID_alter()
 */
function mytheme_form_mycontenttype_node_form_alter(&$form, &$form_state, $form_id) {
  $form['actions']['submit']['#suffix'] = '<p>' . t('Some text to place after the submit button.') . '</p>';
}
capysara’s picture

You can use the same hook_form_alter in D7 as noted in #12. I'm using a multi-page form, and I wanted to use an existing markup field, so I hid the field and used #suffix on 'actions' (not specifically 'submit'):

 // Move the disclaimer_field below the actions (previous/next/submit).
    $form['elements']['disclaimer_field']['#access'] = FALSE;
    $form['actions']['#suffix'] = $form['elements']['disclaimer_field']['#markup'];
scott_earnest’s picture

Webform 6 simply add an element "Submit button(s)", this will give you the crosshairs and allow placement above other elements. If you use the default submit button it will want to be last, even if you place elements after it.

zuhair_ak’s picture

Thanks @scott_earnest , I wanted terms & conditions link after submit button, you solution helped me.

proxiblue’s picture

You can actually also just edit the default submit button, toggle on 'hide submit button', and save.
This seems to add the cross-hairs to the submit button element.

Now place your markup element, set your order, and then re-enable the submit button, and save

This was done on d10 with webform 6.2.0-beta