Making TextArea required and validating the input
-
Hello,
What is the preferred way to make
TextAreaQML type required and how to enable validation of entered contents, considering that this QML type doesn't havevalidatorproperty?Thank you in advance.
-
You can still declare
RegExpValidator(or use already existed from some input likeinput.validator.regExp) to store regExp and test values manually:... RegExpValidator { id: rx regExp: /\d+/ } Component.onCompleted: { console.log(rx.regExp.test("42"), rx.regExp.test("sdg")); // Produces: "true false" } ... -
You can still declare
RegExpValidator(or use already existed from some input likeinput.validator.regExp) to store regExp and test values manually:... RegExpValidator { id: rx regExp: /\d+/ } Component.onCompleted: { console.log(rx.regExp.test("42"), rx.regExp.test("sdg")); // Produces: "true false" } ...@intruderexcluder said in Making TextArea required and validating the input:
You can still declare
RegExpValidator(or use already existed from some input likeinput.validator.regExp) to store regExp and test values manually...That's a good idea.
Thank you.