The paging information (page number and page count) disappeared from version 3.x in $form.

That information can be used for any extended page handling. For example, this info is passed to webform-form.tpl.php and can be used to display the user's progress through the webform.

CommentFileSizeAuthor
#1 webform.module_817204.patch812 byteskhaled.zaidan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

khaled.zaidan’s picture

FileSize
812 bytes
quicksketch’s picture

Category: task » feature
Status: Patch (to be ported) » Needs review

It's not in $form but it is in $form_state I believe. I'll need to see if this information is redundant or not.

khaled.zaidan’s picture

Yes it is in the $form_state. But the problem is that when the form is first created (you're still on the first page, and you still never pressed next or previous) there is no $form_state at all, so the paging info isn't available unless added to the form itself (like in the patch).

miro_dietiker’s picture

Confirm this is needed on $form.

quicksketch’s picture

Status: Needs review » Postponed (maintainer needs more info)

But the problem is that when the form is first created (you're still on the first page, and you still never pressed next or previous) there is no $form_state at all,

This is not true. $form_state is the second parameter of hook_form_alter(): http://api.lullabot.com/hook_form_alter/6.

In a custom module hook_form_alter() I've confirmed that $form_state['webform']['page_num'] exists even on the first page of the form.

I'd like to avoid adding redudant information to the $form array if it serves no purpose. If you can explain a situation where the existing information is not enough I'll take another look at this.

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ah, of course, when theming $form_state is not available (which is why this is a prerequisite for #258696: Multipage form - Page n of n (progress or percentage complete)). I've committed to both 3.x branches. Thanks for your patience on this.

Status: Fixed » Closed (fixed)

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