Posted by requenym on October 31, 2008 at 12:54pm
4 followers
| Project: | Webform |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
First page i have basic text boxes, next page I have a bunch of check boxes, they are all mandatory. If I don't check any boxes and click on the previous page button every checkbox becomes checked and they get errors about those fields being required:
# Intended Audience field is required.
# Audience Skill Level field is required.
# Topic Area(s) field is required.
This is a pain because there are so many check boxes and now the user has to uncheck them all to fill the form out properly.
Comments
#1
Attached is a patch that I think fixes this issue. It will probably need a good bit of testing for each of the different form components in a multipage form. I can't find any problems, but I have not tested thoroughly. It does however fix the checkbox problem.
The problem was the values being stored in $form_state for the multipage form, were not being processed to be safe for saving, so when the values were re-used to re-render the form, they were not what was expected. I've added the submission processing before the values are saved into the form_state.
Let me know how it goes, or if another approach is desired.
#2
Missed the recursive call. Given the context, it shouldn't really be needed to pass though partial_form there, so I'll leave that up to the reviewer as to which patch they wish to use.
Not sure what impacts it might have if it was not there.
EDIT: Having thought about this a little more, I've decided it might be best to go with patch #1. If a parent form element is there, then the child element *should* act as it did before, regardless if this is on a multi-page form or not. Thoughts? Patch is left attached for context.
#3
This does not just happen on multi-page forms. If you rebuild a single page webform with checkboxes on the page, on the form rebuild, all of the checkbox values are checked.
Changing the title as this does only appear to affect checkboxes as far as I can tell.
#4
Re-roll since #262154: Empty file upload w/fieldsets went in, this becomes a much simpler patch.
Simplest use case is to create a webform with 3 components.
The first being checkboxes, (A select component with multiple values).
The second is a pagebreak.
The third can be anything.
To test, check a value in the checkboxes, go to the next page, then select back. All checkbox values will be checked.
The patch fixes this.
#5
Thanks cdale! Great patch, committed as-is. Grid components are still experiencing this problem, but only if they contain an apostrophe or quote, see the fix in #354240: Answers in select fields not accepted if questions contain apostrophe AND the field accepts multiple answers for the fix I used there. I've opened #357184: Grid Component Looses Value on Back/Next with Quotes in the Question for this new issue with the Grid component.
#6
Automatically closed -- issue fixed for two weeks with no activity.