0

I want to change the button text value from "Save Draft" to "Save". How can I target the button (CSS or custom module works for me)? I used to target forms like this:

$form['actions']['submit']['#value'] = 'Ask question';

As there are multiple submit buttons, I don't know how to target the one with the class "webform-draft form-submit".

function customisations_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_client_form_88') {

  }
}

enter image description here

1 Answer 1

2

Code to change the text for Save Draft button is:

function customisations_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_client_form_88') {
    $form['actions']['draft']['#value'] = 'Save';
  }
}

This would change only for Save to Draft button. In order to change the submit button text of the webform, we can use the configuration of the Webform to change it. URL for the same is node/88/webform/configure.

enter image description here

Hope that this helps.

1
  • I changed the submit button already. just needed the draft button. perfect! many thanks
    – user24957
    Commented May 3, 2016 at 9:48

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.