pagebreak gets saved as "submitted_data"
Morbus Iff - March 27, 2008 - 12:51
| Project: | Webform |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Morbus Iff |
| Status: | closed |
Description
1. Create a new webform with an 'email' field.
2. Add a pagebreak.
3. Add a 'textarea'.
4. Save webform.
5. Go to the form and fill it out. Submit.
Results from webform_submitted_data:
| 1 | 2 | 1 | 0 | morbus@disobey.com |
| 1 | 2 | 2 | 0 | Pagebreak |
| 1 | 2 | 3 | 0 | Yep, this is a textarea. |
Expected result: since pagebreak is not a user-submitted field, it shouldn't be saved into webform_submitted_data.

#1
Here's a patch for this. It specifically checks for a component of type 'pagebreak' in the various submission CRUDs. Hardcoding such a component type like this, especially for pagebreak, has precedence - it's scattered throughout webform.module as well. In short, pagebreak is a display option, not a data storage component, and shouldn't be saved as part of a submission. I've tested submitting a new webform, editing this saved webform submission, and editing the saved webform submission with entirely new values. The pagebreak component is not saved into webform_submitted_data.
#2
#3
I couldn't reproduce this problem when editing submissions, but it definitely showed up when submitting new ones. Perhaps there's a browser difference that could cause that inconsistency.
When reviewing though, I didn't experience a difference in where the components were stored in the $node object. In you comments you noted that for updates there isn't a
$node->webform['components'], instead only$node->components. This shouldn't be the case and if components is still existing in the root level of the node object then we have a problem somewhere else.Could you try out the attached patch and see if it corrects the problem?
#4
I'll have to re-test. My original attempt at fixing this problem was pretty much the same as yours - with the webform index on both the insert and update. However, after the updates continued to save the pagebreak item, I did a bunch of dvr()'s and noticed that the structure was different.
#5
I was unable to reproduce the saving of pagebreak, so the patch in #3 is RTBC.
#6
Committed.
#7
Automatically closed -- issue fixed for two weeks with no activity.