diff --git a/assets/js/src/form_editor/blocks/custom_select/edit.jsx b/assets/js/src/form_editor/blocks/custom_select/edit.jsx index ff9afa4bb2..0394abb43c 100644 --- a/assets/js/src/form_editor/blocks/custom_select/edit.jsx +++ b/assets/js/src/form_editor/blocks/custom_select/edit.jsx @@ -66,16 +66,24 @@ const CustomSelectEdit = ({ attributes, setAttributes, clientId }) => { ); const getInput = () => { + let defaultValue = attributes.labelWithinInput ? formatLabel(attributes) : '-'; const options = [{ - label: attributes.labelWithinInput ? formatLabel(attributes) : '-', + label: defaultValue, }]; + if (Array.isArray(attributes.values) || !attributes.values.length) { - attributes.values.forEach((value) => options.push({ - label: value.name, - })); + attributes.values.forEach((value) => { + options.push({ + label: value.name, + }); + if (!attributes.labelWithinInput && value.isChecked) { + defaultValue = value.name; + } + }); } + return ( - { options.map((option) => (