Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • anh-duc-le 38 posts 152 karma points
    Jul 14, 2022 @ 13:39
    anh-duc-le
    0

    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.

    How do we resolve this issue?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 14, 2022 @ 14:13
    Matt Brailsford
    0

    Which version of of Konstrukt are you using?

  • anh-duc-le 38 posts 152 karma points
    Jul 14, 2022 @ 14:17
    anh-duc-le
    0

    We're on version 1.1.1.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 14, 2022 @ 14:33
    Matt Brailsford
    0

    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 🤔

  • anh-duc-le 38 posts 152 karma points
    Jul 14, 2022 @ 14:46
    anh-duc-le
    0

    Client side validation does seem to take place when editing entities. But doesn't seem to trigger on the Entity ActionMenu ActionSettings dialog

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jul 14, 2022 @ 15:11
    Matt Brailsford
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft