Fixed uncheck status not saved in Manage subscriptions page

Please note: Mandatory (required) checkbox Fields can not be Empty. This means the checkbox field can not be uncheck by the user. The admin can still control the status of the checkbox

[MAILPOET-3858]
This commit is contained in:
oluwaseun Olorunsola
2021-11-01 16:06:34 +01:00
committed by Veljko V
parent 62cf852691
commit 2d32e5013e
2 changed files with 11 additions and 0 deletions

View File

@@ -40,10 +40,15 @@ class Checkbox {
);
$selectedValue = $this->rendererHelper->getFieldValue($block);
$isFieldRequired = $this->rendererHelper->getFieldIsRequired($block);
foreach ($options as $option) {
$hiddenValue = $isFieldRequired ? '1' : '0'; // Mandatory Fields can not be Empty
$html .= '<input type="hidden" value="' . $hiddenValue . '" name="' . $fieldName . '" />';
$html .= '<label class="mailpoet_checkbox_label" '
. $this->rendererHelper->renderFontStyle($formSettings) . '>';
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
$html .= 'name="' . $fieldName . '" ';