Currently I validate the value of the TypedInput myself, for example:
var typedInputValue = val.typedInput("value");
if (!/^some_regex_for_email/i.test(typedInputValue)) {
// Invalid email address
}
And then I would have to apply the red border myself.
I do it currently like that because I'm not sure how the TypedInput could do the validation on its own, when I would call the validate function of the TypedInput.
Because when I set a pattern
attribute on the TypedInput, it gets lost. For example:
$('<input type="text" pattern="some_regex_for_email">').typedInput(typedInput);
I could create a PR for a new 'pattern' function on the TypedInput (identical to how @Steve-Mcl did it for the disabled attribute). However - besides the pattern
attribute - the html input contains quite a number of attributes, so not sure whether it is wise/advised to add them all to the TypedInput widget (especially since the attributes differ per value type).
So not sure what is the best way to validate the TypedInput, and get a red border around it...
Any tips are appreciated!