Text Field value not updating correctly using onKeyPress

Hi,

I am performing input validation and am using the text field value to check whether the user has entered any data.
Unfortunately, it seems that the value is not being updated PRIOR to performing onKeyPress but rather AFTER.
This can be seen through the below:


The text is inputted as above, and below is the output


Here is my code:

$w.onReady(function () {
	$w("#txtFName").onKeyPress((eventHandler) => {
		console.log("Value of First Name: " + $w("#txtFName").value);
		if($w("#txtFName").value !== "")
			$w("#text27").collapse();
	});
	
	$w("#txtLName").onKeyPress((eventHandler) => {
		console.log("Value of Last Name: " + $w("#txtLName").value);
		if($w("#txtLName").value.length > 0)
			$w("#text29").collapse();
	});
});

I have tried two different variations of checking the value (by both length and contents)
The outcome is the same on both.
Am I missing something, or am I correct in assuming that the value is not being changed before onKeyPress is called?
If I am correct, is there another way to set this up?

I wish to have my error box disappear when the user enter a value into the box, without needing to click out of the box to apply the change.

Although the query still remains, I have worked around my issue by using a regex to check that the key pressed was a letter in some alphabet, as well checking that only one key was pressed (escape, tab and enter all return as their names)
See below:

$w("#txtFName").onKeyPress((eventHandler) => {
		let key = eventHandler.key;
		if(/[^\d\W]/i.test(key) && key.length === 1)
			$w("#errFName").collapse();
	});

Hi! This issue is known, it’s a bug and it’s handled

Thanks!

Okay, thanks for letting me know!

Hi Mikhail, any update on this? It has been two-and-a-half months.