diff --git a/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js b/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js index b43f360be5..8bd06a26bb 100644 --- a/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js +++ b/src/openforms/js/components/admin/form_design/registrations/objectsapi/ObjectsApiOptionsFormFields.js @@ -40,6 +40,14 @@ const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange}) const [availableObjecttypes, setAvailableObjecttypes] = useState([]); const [availableObjecttypeVersions, setAvailableObjecttypeVersions] = useState([]); + const v2SwitchMessage = intl.formatMessage({ + defaultMessage: `Switching to the new registration options will remove the existing JSON templates. + You will also not be able to save the form until the variables are correctly mapped. + Are you sure you want to continue? + `, + description: 'V2 Switch warning message', + }); + const { version = 1, objecttype = '', @@ -55,14 +63,20 @@ const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange}) } = formData; const changeVersion = index => { + if (index === 1) { + const confirmV2Switch = window.confirm(v2SwitchMessage); + if (!confirmV2Switch) return; + } + onChange( produce(formData, draft => { + draft.objecttype = ''; + draft.objecttypeVersion = ''; + draft.contentJson = ''; + draft.paymentStatusUpdateJson = ''; draft.version = index + 1; }) ); - if (version === 2) { - // open modal - } }; const onFieldChange = event => { @@ -114,7 +128,7 @@ const ObjectsApiOptionsFormFields = ({index, name, schema, formData, onChange}) return ( <> - +