[BUGFIX] Clean Checkbox Values not possible
authorAlex Kellner <alexander.kellner@in2code.de>
Thu, 11 Dec 2014 22:17:37 +0000 (23:17 +0100)
committerAlex Kellner <alexander.kellner@in2code.de>
Thu, 11 Dec 2014 22:17:37 +0000 (23:17 +0100)
related: #63790

Classes/Utility/Div.php
Resources/Public/Js/PowermailCond.js

index 1434dd7..5c2c46c 100644 (file)
@@ -170,7 +170,11 @@ class Div {
                $formKey = 'form_' . intval($formUid);
                $fieldKey = 'field_' . intval($fieldUid);
                $session = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->extKey);
-               $session[$prefix][$formKey][$fieldKey] = $value;
+               if (!empty($value)) {
+                       $session[$prefix][$formKey][$fieldKey] = $value;
+               } else {
+                       unset($session[$prefix][$formKey][$fieldKey]);
+               }
                $GLOBALS['TSFE']->fe_user->setKey('ses', $this->extKey, $session);
                $GLOBALS['TSFE']->storeSessionData();
        }
index fcce9b9..caf6ead 100644 (file)
@@ -59,7 +59,14 @@ jQuery(document).ready(function() {
  */
 function fieldValue(fieldUid, fieldValue) {
        var fieldWrap = $('#powermail_fieldwrap_' + fieldUid);
-       fieldWrap.find('input').not('[type="checkbox"]').val(fieldValue);
+
+       // set value for all default fields
+       fieldWrap
+               .find('input.powermail_field')
+               .not('[type="checkbox"]')
+               .val(fieldValue);
+
+       // check checkboxes and radiobuttons
        fieldWrap.find('input[type="checkbox"]').each(function() {
                if ($(this).prop('value') == fieldValue) {
                        $(this).prop('checked', 'checked');