Field attached Error Message on Custom Widget Control

I like to implement the new rich text editor.

For the moment it is replacing a specific stateless field in the widget map of the form engine.

The applied changes to the data of the rich text editor are saved back to the default dataholder via setData.

Via settings in the model a limitation to 10 chars is set which for example will trigger an ErrorMessage on top of the regular stateless field when value is changed.

I like to have the same behaviour for the rich text editor but can see that the ErrorMessage is not created (probably caused by the fact that no validation is triggered).
I can see that the original stateless field triggers an action something like onValueChange which I assume is responsible for triggering the message creation.

My Question: How can I have same behaviour on rich text editor, is there any form engine api for that or do I have to implement something on my own using the kernels documentRTService?

Thanks in advance :slight_smile:

Hi Markus,

in this case you need to call the default form engine value change handler within the respective callback prop of your custom widget. This will trigger all the default behavior including validation.

In order to achieve this, you will probably need to extend both form model map and widget map.
The extension of the form model map is necessary to create an additional react context that can give you access to some of the control-level props within your custom widget implementation.

You can find a code example in the form engine dev app called custom-input-as-widget.

The documentation also refers to it here: GetA12 Login

Thanks for the input @erik-radiant-gorge
this is really the solution for my question :blush:

To admit I tried this before and failed with that approach…
but after deep analysis :microscope: including checking all the types on the custom chain we stumbled over a little function called createApplicationSetup and somehow we forgot to set the createFormEngineMiddlewares() in additionalMiddlewares.

after fixing that all works exactly like expected when following your approach :melting_face: