I wanted to change the default value of submit button in comment form from "Save" to "Post". I wanted to do that using a module , not javascript. So I wrote the following code in my module.

 function mymodule_form_comment_form_alter(&$form, &$form_state, $form_id){

     $form['actions']['submit'] = array(

      '#value' => t('Post Comments'),   

But instead of changing the value of submit button, this module is making the submit button hidden. If I add return $form , then the submit button displays but with the same default text "Save". Any suggestions please. Thank you.

1 Answer 1


You're replacing the entire element at the moment (which is why it doesn't show). You can change a specific property in the array like so:

$form['actions']['submit']['#value'] = t('Post Comments');

That way you're just setting the #value property, and not removing the other properties that already exist for the element.

  • Yes. That was the mistake I was doing.It works now. Thank you for your quick response Clive. Aug 22, 2012 at 22:29

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.