Enabling the new "Preview page" feature causes an issue on forms that are a single page (i.e. no pagebreaks).

All of the "submit" buttons (e.g. Submit, Preview, Previous) appear with the text "Submit".

When viewing the form, the following notice is generated:
Notice: Undefined offset: 1 in webform_client_form() (line 2380 of [...]/webform/webform.module).

Which corresponds to

      elseif ($page_num < $page_count) {
        $form['actions']['next'] = array(
          '#type' => 'submit',
          '#value' => $next_page_labels[$page_num], // line 2380

The $page_num is 1, but the $next_page_labels only has a value for index 0.

Comments

spadxiii’s picture

I just ran into this issue as well and made a little patch.

The issue is that the next/prev button labels are appended to an array but that array is empty. This means they get index 0, while further in the code, it's looking for index 1 for the next button (and for the previous button 2).

spadxiii’s picture

Status: Active » Needs review
quicksketch’s picture

Status: Needs review » Fixed

Thanks guys! Great to have the preview functionality well tested before the next release. I've committed this patch on top of #435232: Summary/review/preview page before final submission in multistep forms and it should be in tomorrow's release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed 2f48d41 to 8.x-4.x.

  • Commit 4076ea2 on 8.x-4.x authored by SpadXIII, committed by fenstrat:
    Issue #2126559 by SpadXIII: Incorrect button labels with "preview page"...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.