Skip to content

Commit b059057

Browse files
authored
[Improvement]: Add setting to check validity for (Multi)Select before setting values (#1062)
* add enforce validation setting * add description * fix typo
1 parent 52fd8f2 commit b059057

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

public/js/pimcore/object/classes/data/multiselect.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ pimcore.object.classes.data.multiselect = Class.create(pimcore.object.classes.da
137137
editable: false,
138138
forceSelection: true
139139
},
140+
{
141+
xtype: "checkbox",
142+
fieldLabel: t("enforce_validation"),
143+
name: "enforceValidation",
144+
itemId: "enforceValidation",
145+
checked: datax["enforceValidation"] === true
146+
},
147+
{
148+
xtype: "displayfield",
149+
hideLabel: true,
150+
value: t('enforce_validation_explanation')
151+
},
140152
{
141153
xtype: "textfield",
142154
fieldLabel: t("options_provider_class"),

public/js/pimcore/object/classes/data/select.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,19 @@ pimcore.object.classes.data.select = Class.create(pimcore.object.classes.data.da
274274
pimcore.object.helpers.selectField.getOptionsProviderFields(datax, valueGrid)
275275
)
276276

277+
appendedStylingItems.push({
278+
xtype: "checkbox",
279+
fieldLabel: t("enforce_validation"),
280+
name: "enforceValidation",
281+
itemId: "enforceValidation",
282+
checked: datax["enforceValidation"] === true
283+
});
284+
appendedStylingItems.push({
285+
xtype: "displayfield",
286+
hideLabel: true,
287+
value: t('enforce_validation_explanation')
288+
});
289+
277290
appendedStylingItems.push(valueGrid);
278291

279292
return appendedStylingItems;

translations/admin.en.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ enable_grid_locking: "Enable grid locking"
915915
export_configuration: "Export Configuration As JSON"
916916
composite_indices: "Composite indices"
917917
default_value_generator: "Default value generator service / class"
918+
columnlength: "Column length"
919+
enforce_validation: "Enforce validation"
920+
enforce_validation_explanation: "When enabled, it prevents invalid options from being saved. By default, the API allows saving invalid options"
918921
no_value_set: "no value set"
919922
replace_assignments_in_all_elements: "Replace assignments in all elements"
920923
fieldlookup: "Field Lookup"

0 commit comments

Comments
 (0)