Set validation regex on KonstruktSettingsConfigBuilder in a custom KonstruktAction
We have a custom KonstruktAction implementation with custom ActionSettings. One of the custom action settings is a decimal field for which we are using a custom Umbraco decimal data type.
The custom Umbraco decimal data type is set with steps of 0.01 so the user can define numbers like 12.05 and 3.5 in the fields.
But there is nothing stopping the user from inputting 8.567 in the ActionSetting input field.
When an invalid input is entered in the field, no validation seems to take place and we simply receive the value 0 when the value 8.567 is entered.
We have tried using SetValidationRegex but that doesn't seem to do anything on the ActionSettings fields.
Ok, I think I see what the problem is here, and that is that Umbraco doesn't actually perform any regex validation client side, instead these occur server side, but as we are really just relying on client side for the actions menu.
I'll have to review if it's possible for us to implement server side validation of the action model before continuing with the action, but in the meantime I think your best bet would be to implement your own property editor with the validation baked in, rather than reusing the inbuilt decimal input.
Set validation regex on KonstruktSettingsConfigBuilder in a custom KonstruktAction
We have a custom KonstruktAction implementation with custom ActionSettings. One of the custom action settings is a
decimal
field for which we are using a custom Umbracodecimal
data type.The custom Umbraco
decimal
data type is set with steps of0.01
so the user can define numbers like12.05
and3.5
in the fields.But there is nothing stopping the user from inputting
8.567
in the ActionSetting input field.When an invalid input is entered in the field, no validation seems to take place and we simply receive the value
0
when the value8.567
is entered.We have tried using
SetValidationRegex
but that doesn't seem to do anything on the ActionSettings fields.How do we resolve this issue?
Which version of of Konstrukt are you using?
We're on version 1.1.1.
Hmm, then that's strange. 1.1.1 introduced client side validation so the regex validation should be taking place when you click OK on the dialog 🤔
Client side validation does seem to take place when editing entities. But doesn't seem to trigger on the Entity ActionMenu ActionSettings dialog
Ok, I think I see what the problem is here, and that is that Umbraco doesn't actually perform any regex validation client side, instead these occur server side, but as we are really just relying on client side for the actions menu.
I'll have to review if it's possible for us to implement server side validation of the action model before continuing with the action, but in the meantime I think your best bet would be to implement your own property editor with the validation baked in, rather than reusing the inbuilt decimal input.
EDIT I've raised a bug for this here which I'll keep updated with any progress https://github.com/outfielddigital/konstrukt/issues/34
is working on a reply...