Can that be used for my purpose? And could anybody provide a simple example? I certainly must be overthinking it, but I am not sure how to specify my regex...
Hey Steve,
I have no screen yet for this part. Currently I have a simple text input element, with a regex to validate the input based on some pattern. For example:
Ah that explains my confusion. Indeed I thought it was used for validating an input based on a regex, and I had no idea where to specify that regex
So my case is this: some property needs to be a string, that needs to contain a pattern. The string can be hardcoded in the config screen, or injected via an input message. So the types of my TypedInput are ["str", "msg"]. But in the config screen the pattern matching test should only be applied when type is "str", not for "msg".
While writing my problem down here, I assume you are going to tell me that I need a validation function that only checks the pattern if type is "str"...
You can define your own type that is a copy of the str type, but with your added custom validation rule:
types: [
{
value: "str",
label: "Bart's String",
icon: "red/images/typedInput/az.svg",
validate: function (value, opt) {
// return true/false depending on if `value` is valid or not
}
},
'msg'
]