1

By default, the web form is displayed with <?php print drupal_render($form['submitted']); ?> .

I need to make a small edit and add class="btn" to the submit button.

I can change its value with $form['actions']['submit']['#value'] = "click to become a member";

But I couldnt find a way to add the class.

Please help!

Thank you

1 Answer 1

0

I think that you have to do something like this (add an array):

$form['actions']['submit']['#value'] = "click to become a member", array('attributes' => array('class' => array('btn'), 'style' => array('CUSTOM STYLE DIRECTLY') ));

I'm not really sure if is there is the right place the you have to add that code, but that generally it's this code:

, array('attributes' => array('class' => array('btn'), 'style' => array('CUSTOM STYLE DIRECTLY') ))
2
  • I get syntax error with this code.
    – Efe
    Commented Jul 26, 2013 at 2:13
  • Ok, it's normal. Can you provide more details of code that you are working on? Copy the block code or the function and paste it here that i can analyze it.
    – ottosatto
    Commented Jul 26, 2013 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.