Closed (fixed)
Project:
Webform
Version:
8.x-5.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2018 at 11:26 UTC
Updated:
11 Apr 2018 at 17:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jrockowitz commentedI don't think hidden elements should support #states.
Hidden elements can currently be excluded from the preview page and email.
Comment #3
jrockowitz commentedI miss read the issue. I don't see any easy solution.
Comment #4
Ice-D commentedSorry, by "hidden" I meant "invisible". Will change the title. Do you think it is an issue worth tackling?
Comment #5
Ice-D commentedComment #6
Ice-D commentedThe problem mainly concerns checkboxes and radios. Other elements can be hidden on the preview page if empty. (Invisble elements are "empty" to webform)
Can we have an option to hide checkbox/radio elements on the preview if they are not checked?
Comment #7
jrockowitz commentedThere is definitely an issue here because a hidden checkbox should be stored as a NULL value and a visible unchecked checkbox should be stored as FALSE.
Comment #8
Ice-D commentedAny new insights on this?
Comment #9
jrockowitz commentedNullifying conditionally hidden elements is going to require a bit of work and a lot of testing. If we are not careful we could cause people to lose data.
Comment #10
nodecode commentedMy forms have quite a few conditionally-hidden elements and the Preview/Submissions are fairly indecipherable both for the person filling out the form and the person receiving the submission. I'm not the best at debugging code but I do understand it and I'm willing to look into it if you need a hand. Otherwise I'm watching this issue closely and here to test thoroughly.
Comment #11
Ice-D commentedMy temporary solution is to hide all the checkboxes that aren't checked. Just put this in a custom module.
Comment #12
nodecode commented@Ice-D, for me it's also affecting Text fields which contain default values but are hidden so they shouldn't be included in the Preview/Submission.
@jrockowitz, If you're wary about this being fixed and people losing data, perhaps there could be a checkbox in the settings to "Exclude hidden elements" from the Preview they same way there exists "Exclude empty elements". Just a thought.
Comment #13
jrockowitz commentedAttached is a test webform and a patch that checks if an element is conditionally hidden when it is being viewed.
It is possible that this pretty basic patch could solve a lot of problems. Once all the existing tests pass I will add some additional test coverage.
Comment #16
jrockowitz commentedComment #18
jrockowitz commentedComment #20
jrockowitz commentedComment #21
jrockowitz commentedI committed the patch. Please download the latest dev release to review.
Comment #22
nodecode commentedIt seems to be working well in my tests of more complex forms.
Comment #23
jrockowitz commented@nodecode The issue that really needs some QA is #2918669: Elements separated by conditional inside multistep wizard are both saved to submission