Hello all,
Found a minor issue while trying to add a fieldset element. It appears since 'fieldset', 'file', 'markup', 'pagebreak' elements do not have the option to be encrypted, when the form goes through the webform_encrypt_webform_component_presave() function you get the fallowing error Undefined index: encryption in webform_encrypt_webform_component_presave( (/sites/all/modules/webform_encrypt/webform_encrypt.module) on line 50.
I had also previously edited the module to fix a different error discussed here: http://drupal.org/node/1196126
After going through the module I think I have an idea on how it could be fixed. I will test my solution and post afterwards but I'm open to suggestions.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 1344804-12.patch | 582 bytes | l0ke |
| #5 | 1344804.patch | 587 bytes | akoepke |
Comments
Comment #1
timbhowe commentedOk this is my current solution. On line 18 modify the webform_encrypt_form_alter() to add the encryption check box but disable and with a default value of 0 on 'fieldset', 'file', 'markup', 'pagebreak' form elements.
I did this so that the user would know that this type of element can't be encrypted but that the module is running. If any one has an alternative solution please feel free to share.
Thanks, hope to see this in the next release.
Tim
Comment #2
timbhowe commentedComment #3
akoepke commentedI found a similar issue with the markup field. In this case there is extra data (format of the markup) which is wiped out due to the way the webform_encrypt_webform_component_presave function is written.
Not having the encryption form element isn't an issue, I think it is easier to just check if this data exists when doing the presave.
This just requires one extra line (not counting the closing bracket) and resolves both of our problems.
Comment #4
akoepke commentedComment #5
akoepke commentedI have rolled a proper patch for my edit which is attached to this post. This patch was created using the current dev version.
Comment #6
akoepke commentedComment #7
cviccaro commentedakoepke, the patch worked perfectly to resolve the undefined index: 'encryption' errors. Thanks!
Comment #8
pebosi commentedWorks for me, too.
Comment #9
dandaman commentedThis worked for me and I believe it also fixes the problem in here:
#1511826: Select List and Conditional Rules not saved
Actually, I wrote my own and used isset() instead of empty(). I think that's better because empty() will throw a notice or warning or something if the array key doesn't exist, right?
Comment #10
akoepke commentedAs per the PHP manual (http://php.net/empty) empty doesn't throw any warnings
empty() is the opposite of (boolean) var, except that no warning is generated when the variable is not set.
isset and empty are similar, empty is just a bit broader in scope (ie if array key exists but has no values assigned to it.)
Comment #11
theunraveler commentedFixed in 7.x-1.x and 6.x-1.x. They will be included in the next release.
Thanks for the patches and discussion.
Comment #12
l0keThere is
webform_encrypt.module.origfile name in previous patch< so I change it to webform_encrypt.module.Comment #13
naiduharish commentedHi @theunraveler,
What is the impact of using is_array instead of !empty() condition in the patch.