Disable segments validation when form ID is empty

[MAILPOET-4155]
This commit is contained in:
Jan Lysý
2022-04-06 11:30:26 +02:00
committed by Veljko V
parent 8f377d9308
commit eb07872d13
2 changed files with 4 additions and 4 deletions

View File

@ -47,11 +47,12 @@ class BlockRendererHelper {
}, $errorMessages)) . ']';
}
if ($blockId === 'segments') {
// Segments should be required only when form ID is not empty. That allows save form on subscription management site when any segment is not checked.
if ($blockId === 'segments' && $formId) {
$rules['required'] = true;
$rules['mincheck'] = 1;
$rules['group'] = $blockId;
$rules['errors-container'] = '.mailpoet_error_' . $blockId . ($formId ? '_' . $formId : '');
$rules['errors-container'] = '.mailpoet_error_' . $blockId . '_' . $formId;
$rules['required-message'] = __('Please select a list.', 'mailpoet');
}