Hi,
We are trying to use the OnKeyDown event to validate a string in a text field but it doesn’t trigger at all.
Is there a bug with this event?
I even tried with a simple script
if len(self.props.text) >= 3:
self.props.text = "3 chars"
Hi,
We are trying to use the OnKeyDown event to validate a string in a text field but it doesn’t trigger at all.
Is there a bug with this event?
I even tried with a simple script
if len(self.props.text) >= 3:
self.props.text = "3 chars"
It looks like you’re using Perspective, so I’ll chime in.
The onKeyXXXX Events only execute if the component they are attached to is the component which currently has focus.
For example:
Alternatively, you should verify that props.deferUpdates
is not set to be true
. If this property is active, props.text
will not update until AFTER the user applies the current text, and so your condition will actually not happen unless the props.text
field ALREADY has more than 3 characters when the user begins typing.