[TASK] Rename JS var input to fields and select an field starting with id to select...
authorOliver Eglseder <oliver.eglseder@in2code.de>
Tue, 8 Sep 2015 14:20:42 +0000 (16:20 +0200)
committerOliver Eglseder <oliver.eglseder@in2code.de>
Tue, 8 Sep 2015 14:20:42 +0000 (16:20 +0200)
Resources/Public/JavaScript/PowermailCondition.js

index 38b7154..1b1ceab 100644 (file)
@@ -51,15 +51,15 @@ function PowermailCondition($formElement) {
                                                var form = $('.powermail_form_' + formUid)
                                                for (var pageUid in data.todo_field[formUid]) {
                                                        for (var fieldMarker in data.todo_field[formUid][pageUid]) {
-                                                               var input = form.find('#powermail_field_' + fieldMarker);
+                                                               var fields = form.find('[id^=powermail_field_' + fieldMarker + ']');
                                                                if (data.todo_field[formUid][pageUid][fieldMarker]['action'] === 'hide') {
-                                                                       input.val('');
-                                                                       input.prop('disabled', true);
-                                                                       input.closest('.powermail_fieldwrap').hide();
+                                                                       fields.val('');
+                                                                       fields.prop('disabled', true);
+                                                                       fields.closest('.powermail_fieldwrap').hide();
                                                                }
                                                                if (data.todo_field[formUid][pageUid][fieldMarker]['action'] === 'un_hide') {
-                                                                       input.prop('disabled', false);
-                                                                       input.closest('.powermail_fieldwrap').show();
+                                                                       fields.prop('disabled', false);
+                                                                       fields.closest('.powermail_fieldwrap').show();
                                                                }
                                                        }
                                                }