diff --git a/assets/js/src/form_editor/blocks/first_name/edit.jsx b/assets/js/src/form_editor/blocks/first_name/edit.jsx index 81835a568c..1bb224b925 100644 --- a/assets/js/src/form_editor/blocks/first_name/edit.jsx +++ b/assets/js/src/form_editor/blocks/first_name/edit.jsx @@ -47,13 +47,20 @@ const FirstNameEdit = ({ attributes, setAttributes }) => { /> ); + const getLabel = () => { + if (attributes.mandatory) { + return `${attributes.label} *`; + } + return attributes.label; + }; + return ( <> {inspectorControls} - {attributes.labelWithinInput ? (getTextInput(attributes.label) + {attributes.labelWithinInput ? (getTextInput(getLabel()) ) : ( diff --git a/assets/js/src/form_editor/blocks/last_name/edit.jsx b/assets/js/src/form_editor/blocks/last_name/edit.jsx index 69c5292955..627daaad49 100644 --- a/assets/js/src/form_editor/blocks/last_name/edit.jsx +++ b/assets/js/src/form_editor/blocks/last_name/edit.jsx @@ -47,13 +47,20 @@ const LastNameEdit = ({ attributes, setAttributes }) => { /> ); + const getLabel = () => { + if (attributes.mandatory) { + return `${attributes.label} *`; + } + return attributes.label; + }; + return ( <> {inspectorControls} - {attributes.labelWithinInput ? (getTextInput(attributes.label) + {attributes.labelWithinInput ? (getTextInput(getLabel()) ) : (