Reset text field on entry

I have a textfield that I would like to have reset itself whenever something is entered into it. By default, when you enter text into the text field and press enter, the text doesn’t go away, so the user has to hit the backspace button to make another entry. This is quite awkward if the user is using an HID hand scanner.

I have a change script attached to the box to do processing on it once the enter key is pressed. I have tried

if origin == "Browser":                                                                #keep script from firing itself
	self.getSibling("Label").props.text = currentValue.value   #just an example action
	self.props.text = ""                                                             #should erase myself?

I would think the last line would reset the textfield, but it doesn’t. Am I missing something here?

Thanks
Ken

And after messing with this for an hour this afternoon… I found it 2 minutes after I wrote this post.

For posterity’s sake, make rejectUpdatesWhileFocused false and the changes script above will work.

Ken

1 Like

It sounds like @ken.maze found a solution himself. It appears that using a version of the property change script found above, along with a false setting on the rejectUpdatesWhileFocused property (to keep the script from firing while you type), gave the results OP was looking for.

However, from the scripting, it looks like this is in Perspective so my knowledge ends there haha.

1 Like