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

Morbus Iff - March 28, 2008 - 12:58
Status:active» needs review

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.

AttachmentSize
p_239336_pagebreak.patch 1.54 KB

#2

Morbus Iff - March 28, 2008 - 13:07
Assigned to:Anonymous» Morbus Iff

#3

quicksketch - March 29, 2008 - 20:16

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?

AttachmentSize
webform_pagebreak_data.patch 1.41 KB

#4

Morbus Iff - March 29, 2008 - 23:02

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

Morbus Iff - March 31, 2008 - 12:47
Status:needs review» reviewed & tested by the community

I was unable to reproduce the saving of pagebreak, so the patch in #3 is RTBC.

#6

quicksketch - March 31, 2008 - 20:35
Status:reviewed & tested by the community» fixed

Committed.

#7

Anonymous (not verified) - April 14, 2008 - 20:42
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.