Here's the better way
validator: RegExpValidator { regExp: /\d{4}/ } onTextChanged: confirmButton.enabled = acceptableInput
Here's the better way