This patch allows the text on the back and next buttons to be customised as per the submit button.


quicksketch’s picture

Status: Needs review » Needs work

I've thought about adding something like this before but I haven't been able to get around to it. I think it'd be more appropriate to add these options to the pagebreak component rather than as properties of the entire webform. That way you could make a buttons for example like "Step 1. Personal Information" and "Step 3. Specific requests". I'd love to include this functionality though!

Also, the patch has a few minor spacing issues.

marcingy’s picture

Status: Needs work » Needs review
5.88 KB

Spacing corrected and changed update no in install to reflect new naming.

I like the idea of the page break stuff but I don't have requirement for doing that piece of work.

Also you shouldn't have to set the label on a per page break basis if you want the same labelling pre-page.

Maybe the approach should be to allow form level configuration (this patch) and then allow for breaks to override the text when it has been set at a break level (new patch)

quicksketch’s picture

Status: Needs review » Needs work

I'd really prefer this be a component level feature rather than for the entire form. Having "global" and "local" configuration options are confusing and unpredictable in their behavior. If you need to use the same labels across several page breaks, webform provides the 'clone' feature for components. I won't commit this as a webform level feature.

jazzitup’s picture

Can you suggest any other way of implementation of this feature within a webform?
I find this feature very useful.

isaac.niebeling’s picture

Hey all -

For my use, it's OK if all the Previous & Next buttons are the same--I've only got 2 steps, so there's only one Next. Two questions:

1. Will this patch work for that use (understanding that it would be better if it worked like quicksketch describes)?
2. Why won't just using $form['next']['#value'] = 'Send'; work? I'm guessing webform is looking for the specific value.



quicksketch’s picture

Version: 5.x-2.0-beta2 » 5.x-2.1.2
Assigned: marcingy » Unassigned

Currently you can't simply change the value of the buttons because Webform specifically looks for the words "Previous" and "Next" as the values. Since there are two buttons on the page, Webform needs to be able to associate the value with what action to take.

The patch worked fine as described when it was submitted. It might be out of date though now and not apply to the current code.

isaac.niebeling’s picture

I had to patch the patch a little bit--looks like some of the line numbers had changed, so part of it didn't apply quite right, but it's all working the way I need now.

Thanks for such a great module.


sampeckham’s picture

Hi I was just searching to see if this was possible in Webform and found this thread.

Any chance this has progressed since July? Also, I'm using D6 and I like your idea quicksketch about applying the option to Pagebreak (it's the first place I checked when wanting to do it), is this feature being considered or added or is too low priority at the moment?

If not, can you suggest a temporary alternative (I only need to customize it in one form at the moment), and am happy to even apply a hard coded solution on this basis.



quicksketch’s picture

I'm still all-for adding labels in the pagebreak component, however, I don't have time to work on this. If patches can be made for both Drupal 5 and 6 versions, I'd be happy to add the functionality.

jorisx’s picture

Is this patch still working for the latest webform release 6.x-2.3?

I need to change the next en prev. button names on a site, what's the best way to fix this ?

or should I use Multiform? but that's not released for 6 yet ...

jazzitup’s picture

Don't use this patch. Try to use jQuery within a markup to do that.
If you want images instead of standard buttons, you could write your text on an image and use CSS only!

tim.plunkett’s picture

Version: 5.x-2.1.2 » 6.x-2.x-dev

Any progress on this?

After Drupalcon, of course. Just bringing it back into the light.

miro_dietiker’s picture

BTW We've used the localization to translate and thus change the button text globally. (OK, that's no per-webform setting... but still more custom.)
You even can do this for english by translating the drupal system into a custom english language set. We always do that to customize default text.
So what we best need is e.g. a option to the separators to rename the text button... Page by page... But this would be needed to be added to both PREV and NEXT buttons depending on what's next or prev. Would this be more what you like?

froboy’s picture


jack.r.abbit’s picture

Version: 6.x-2.x-dev » 6.x-3.9
Status: Needs work » Needs review
2.68 KB

I have coded up a quick patch that will add two fields to the pagebreak component allowing the user to define the text for a Next and Prev buttons. The pagebreak is not a visual element but it is associated with the page that follows it. Since a form will always have one less pagebreak than it will have pages, for any given pagebreak the "next" button actually shows on the page before and the "prev" button shows on the page after.

I welcome your thoughts on my approach, wording, etc.

Nitebreed’s picture

#15 Thank you for this patch! saved my day :)

makalov’s picture

Can someone write this patch to work with the drupal 7 version? I applied the code change but keep getting undefined offset notices.

eromba’s picture

Version: 6.x-3.9 » 6.x-3.x-dev
3.66 KB

I could not get the patch in #16 to apply on the 6.x-3.17 release. When I applied it manually, I ended up with a warning: "array_merge(): Argument #1 is not an array" in includes/

I've attached a patch that applies against the 6.x-3.x branch and fixes the above issue.

quicksketch’s picture

Status: Needs review » Fixed
4.07 KB

This is a truly great patch. Thanks eromba, jack.r.abbit, and (long, long ago) marcingy for the work! I can't believe this issue is over 4 years old. Committed to both 3.x branches with a few updates:

- Used "_label" instead of "_value" in variable names.
- Fixed strings to use proper < and >, preventing HTML rendering problems.
- Fixed the array_merge() error with a slightly different approach.

Thanks all.

quicksketch’s picture

4.06 KB

Actually one more fix before committing. The t() around t($component['extra']['next_page_label']) had to go. We now can provide translation through

jack.r.abbit’s picture

Awesome. Glad to see I could be useful.

Status: Fixed » Closed (fixed)

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