Skip to content

Commit

Permalink
[BUGFIX] Support additional checkboxes in email4link lightbox
Browse files Browse the repository at this point in the history
Before this commit values of additional checkboxes (e.g. registration for newsletter) were sent every time an email4link popup was submitted even if the checkbox was not checked.

Related: https://projekte.in2code.de/issues/65254
  • Loading branch information
einpraegsam committed Jul 18, 2024
1 parent aee4445 commit 13c37e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Resources/Private/Build/JavaScript/Frontend/Lux.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,15 +968,13 @@ function LuxMain() {
var target = link.getAttribute('target');
var sendEmail = link.getAttribute('data-lux-email4link-sendemail') || 'false';

var formArguments = {};
var form = that.lightboxInstance.element().querySelector('[data-lux-email4link="form"]');
for (var i = 0; i < form.elements.length; i++) {
var field = form.elements[i];
var name = field.getAttribute('name');
if (name !== null && name.indexOf('email4link[') !== -1) {
var value = field.value;
var nameParts = name.split('[');
name = nameParts[1].substring(0, nameParts[1].length - 1);
var formData = new FormData(form);
var formArguments = {};

for (var [key, value] of formData.entries()) {
if (key.startsWith('email4link[')) {
var name = key.split('[')[1].split(']')[0];
formArguments[name] = value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/Lux/Lux.min.js

Large diffs are not rendered by default.

0 comments on commit 13c37e3

Please sign in to comment.