From b8b52d5a727a25572e76bb50bc7f9b6e288aa1aa Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 6 Aug 2024 08:41:11 -0600 Subject: [PATCH] Et2Textbox: Also accept RegExp as validator Previously only accepted string --- api/js/etemplate/Et2Textbox/Et2Textbox.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Textbox/Et2Textbox.ts b/api/js/etemplate/Et2Textbox/Et2Textbox.ts index 44c4799195..d53c1912d7 100644 --- a/api/js/etemplate/Et2Textbox/Et2Textbox.ts +++ b/api/js/etemplate/Et2Textbox/Et2Textbox.ts @@ -90,7 +90,7 @@ export class Et2Textbox extends Et2InputWidget(SlInput) return this.__validator; } - set validator(value) + set validator(value : string | RegExp) { if(typeof value == 'string') { @@ -106,6 +106,11 @@ export class Et2Textbox extends Et2InputWidget(SlInput) this.requestUpdate("validator"); } + else if(value instanceof RegExp) + { + this.__validator = value; + this.requestUpdate("validator"); + } } }