When I create a webform with form components within fieldsets, the submitted data is encrypted but not decrypted (when viewed via the "Results" section of the webform). It also dumps cleartext in random places--on one rather large form, it dumped cleartext above all of the fieldsets; on another, it dumped it after the first.
I've been able to replicate this issue with all new and existing forms; and as soon as the form components are outside the fieldset, the data is encrypted and decrypted as expected.
This is not a clean install of Drupal--I've taken over the project from a developer who recently left the company--however I can't find any modules or functions that might be interfering with it.
Is this a known issue, or something that might just be a problem with my system?
Due to accessibility and security requirements of my company, we must use fieldsets in all our forms and encrypt every possible field, so any help that can be provided would be greatly appreciated.
Edit: I've just tested the encrypted fieldset data and found that it's not being encrypted properly (ie. it cannot be decrypted with the decrypt() function).
Comments
Comment #1
charlie-s commentedI'm experiencing this on D6.
Comment #2
charlie-s commented(I'm using version 6.x-1.x-dev, datestamp 1307580853)
Perhaps I'm not experiencing the same thing, as in my case the data is indeed being encrypted and decrypted properly, it's just being printed un-themed at the beginning of the $content variable output because the render array is getting messed up.
On webform_encrypt.module line 97 the form_key is being discovered improperly for fields that live inside fieldsets:
which is then inserted into
but that is not a real value when the field lives inside a fieldset. It's something like $renderable['fieldset_name'][$form_key]['#value']. The code below should work for an infinite amount of fieldsets, although it kind of brute forces it. If anyone has suggestions on how to make it more efficient please post your thoughts.
Comment #3
jdblank commentedWill the above code work for D7?
Comment #4
jdblank commentedWill the above code work for D7?
Comment #5
charlie-s commentedI think you need to open a separate issue for D7 version.
But, go ahead and take a look at webform_encrypt.module in the 7.x-dev branch and see if the same thing is happening that I described above.
Comment #6
grguth commentedThis is really an issue with the form api and fieldsets. The same issue comes up using hook_form_alter. The only dependable way to find where the real field definition data in a fieldset is stored is to walk recursively down the form looking for the field name just as the solution above shows. If you don't, its very simple to think you've found the actual part of the structure you want only to have the wrong area of the structure.
Comment #7
akoepke commentedI have implemented a different approach for D7, didn't see this post until I had finished working on my patch.
The D7 patch can be found here #1503786: Encrypted items inside a fieldset are not decrypted when submission is viewed.
I did think of using a helper function like the above patch but in the end I used the parent IDs.
Comment #8
theunraveler commentedDuplicate of #1503786: Encrypted items inside a fieldset are not decrypted when submission is viewed.
Comment #8.0
theunraveler commentedTested encrypted fieldset data