Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal 7 Multistep forms - Remove save & preview button until last step

Tags:

drupal-7

I have made a multistep/page form in Drupal (the field type is a multipage group, with multipages nested).

The form is 6 pages, and there is required info on every page. The problem is, Drupal puts a "Save" and "Preview" button on the bottom of every page of the form. Really, you CANNOT preview the form or save it until all required fields are filled out. So when users are going through the form and they hit "save" halfway through or "preview" halfway through, they get a ton of errors.

Is there any way to remove the "save" and "preview" buttons until they are on the last page (i.e. page 6 only)?

Thanks.

EDIT: I am using Field Groups to build my form by the way.

like image 323
swinkel Avatar asked Jul 22 '15 20:07

swinkel


1 Answers

There isn't any module I found to do this, not in it's entirety anyway.

We ended up removing the preview button completely with CSS, and installing a module (Required For Publishing) that allows you to specify "Fields Required for Publish" vs fields required to save a draft. Now there's only 3 fields to save a draft for later, but 20+ fields required to publish the event/form.

We used javascript in the multipage.js form to validate on each step so they can't move on without filling out the actual required fields on each page.

like image 128
swinkel Avatar answered Sep 24 '22 21:09

swinkel