added a getInputText API, cleaner and more robust than the .text attribute which is often updated too late in event handlers after a redraw

This commit is contained in:
Araq 2020-12-08 18:02:59 +01:00
commit 9a627985d0
4 changed files with 8 additions and 4 deletions

View file

@ -250,8 +250,8 @@ captures the ``field`` parameter:
proc validateNotEmpty(field: kstring): proc () =
result = proc () =
let x = getVNodeById(field)
if x.text.isNil or x.text == "":
let x = getVNodeById(field).getInputText
if x.isNil or x == "":
errors.setError(field, field & " must not be empty")
else:
errors.setError(field, "")