Score:1

How do I remove the "Save draft" button from every page of a multi-step form?

cn flag

I have a multi-step webform and I want to add a save draft button however it needs to be added only to the last preview page and not all step pages.

I have used settings within submission to activate saving draft however the button appears on each page. Any way to hide, without changing code but just through configuration/settings?

Score:1
cn flag

Create a new module and then you can check the $form_state page to conditionally enable to disable buttons.

function submission_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_submission_xyz') {
    $form['actions']['button or field']['#access'] = $form_state->get('current_page' )== 'abcd';
}
leymannx avatar
ne flag
Wasn't there a simple setting/permission you can uncheck?
us flag
There is no setting/permission; this is a good solution. Another approach would be using CSS to hide the 'Save draft' button, which is not as good a solution.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.