Clearing a numeric field

So when I hit backspace and delete everything in my component, it reverts back to the original value, I want to set it to 0. How can I do that? I tried the following




My commit on focus loss and reject updates during edits is set to true.

if event.propertyName == "editValid":

	if event.newValue == True:
		event.source.intValue = 0

This code should work but it would be helpful to know what you are trying to do. Ideally you would want to reset the component value to 0 somewhere else when you hit a "Submit" or "Enter" button.

Worked. Thank you :grinning:

I was trying so that when backspace is entered and everything is cleared, it would set it be 0 instead of reverting back to the previous value. Example : if I put in 12345 and hit backspace one at a time, clear everything out and hit enter, it would go back to 1.

1 Like