# Clearing a numeric field

**URL:** <https://forum.inductiveautomation.com/t/clearing-a-numeric-field/94001>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 31, 2024, 7:46pm UTC](https://forum.inductiveautomation.com/t/clearing-a-numeric-field/94001 "2024-07-31T19:46:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isha\_Paudel](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@Isha\_Paudel](https://forum.inductiveautomation.com/u/Isha_Paudel)\
**Post date:** [July 31, 2024, 7:46pm UTC](https://forum.inductiveautomation.com/t/clearing-a-numeric-field/94001/1 "2024-07-31T19:46:42Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f2a165fa216972d99366358a899361df1db547ce.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/f/2fbc394179ceb805f66fee3abaaafaf159e5ab07.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/1/a1b86f12a0487b39fbe002667cc0d91c14e847b4.png)  
My commit on focus loss and reject updates during edits is set to true.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [July 31, 2024, 9:13pm UTC](https://forum.inductiveautomation.com/t/clearing-a-numeric-field/94001/2 "2024-07-31T21:13:17Z")

</div>

```python
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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f25b548f4122dec0c4432cf34a6d91612e953b5a.png)

---

<div class="post-metadata">

**Author:** ![Isha\_Paudel](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@Isha\_Paudel](https://forum.inductiveautomation.com/u/Isha_Paudel)\
**Post date:** [July 31, 2024, 9:29pm UTC](https://forum.inductiveautomation.com/t/clearing-a-numeric-field/94001/3 "2024-07-31T21:29:21Z")

</div>

Worked. Thank you 😀

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.
