How to place markup after the submit button in drupal 7

drupaldrupal-7drupal-modules

goal : I want to place a text after the submit button using hook_form_alter.

Below is my code but if I use the weight key in the array then its postion does move in the form but not below the submit/save button. What can I do for it to go below the save button ?

$xdmp_twoshow="text";

$form['previewxdmp'] = array(
'#type'=>'markup',
'#markup'=>$xdmp_toshow,
'#weight' => 35,
 );    

Best Answer

Each element can have a #prefix and #suffix property which will place text/HTML immediately after the rendered output. With that in mind you can simply attach a suffix to the existing submit button like so:

$form['submit']['#suffix'] = '<p>Some text to place after the submit button</p>';

Obviously the location of the submit button within the $form array might be slightly different depending on the form you're altering.

Related Topic