Unsolved TextField still allows user input "0" with validator: IntValidator {bottom: 1; top: 100;}
-
It will not pass this value to backend.
How to forbid input "0" with a popup hint string?
Thanks~ -
Have tried with accepted() signal ? This will emit only if the input is valid. You can show pop-up inside the accepted signal handler.
-
Thank you!
When input is invalid, it keeps silent.
So I finally do a trick by forcing no "0" from the begin (The input needs to be integers start from 1).
onTextChanged: {
if(text.substring(0, 1) == "0")
text = "1"
} -
hi,
TextField{
validator: RegExpValidator { regExp: /^[1-9][0-9]*$/ }
}