0

Ive created the a button

$form['submit'] = array(
 '#type' => 'submit',
 '#value' => 'verify',
 '#tree' => TRUE,
);

And I have added some markup code

 $form['submit']['verify'] array(
 '#markup' => 'example text',
 );

The button and the markup text display correctly as individual elements.

But I would like to replace the verify value in the submit element with the markup text. I cant just change the text because the markup is going to contain html.

Ive tried making the markup a variable, tried making it a child element. everything I can think of. But I just cant get the button to span around the markup.

Any advise is appriciated.

Thanks

Sam Healey
  • 666
  • 2
  • 8
  • 22

1 Answers1

1
$form['submit'] = array(
 '#type' => 'submit',
 '#value' => 'verify',
 '#tree' => TRUE,
 '#prefix' => '<div class="fancy-submit">',
 '#suffix' => '</div>',
);

I'm wondering why you don't use css with default classes to implement the styling though.

Clive
  • 36,918
  • 8
  • 87
  • 113
AKS
  • 4,618
  • 2
  • 29
  • 48