# Text Input Clear Text

**URL:** <https://forum.inductiveautomation.com/t/text-input-clear-text/46712>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [May 14, 2021, 1:31pm UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712 "2021-05-14T13:31:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![colin.bonner](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@colin.bonner](https://forum.inductiveautomation.com/u/colin.bonner)\
**Post date:** [May 14, 2021, 1:31pm UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712/1 "2021-05-14T13:31:21Z")

</div>

I am attempting to scan multiple 10 character long barcodes into a table using the same text field input. A key released event populates the Table. I cannot for the life of me get the text box to clear after a scan of 10 characters or more. I have tried lots of things, such as invoke later and other component bindings etc.

The table updates and the test message ‘clear attempted’ is printed to the console so I know the function is running. It will not clear the text field. Please help, I have tried lots of other methods to no avail.

```auto
id= event.source.text
if len(spoolID) >= 10:
	def reset():
		event.source.text = ""
		#print "clear attempted"			
	#tableData = event.source.parent.getComponent('Table').data
	#tableData = system.dataset.addRow(tableData,[id])
	#event.source.parent.getComponent('Table').data = tableData
	reset()

```

Ign 8.1.3

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 14, 2021, 3:17pm UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712/2 "2021-05-14T15:17:01Z")

</div>

The only strange thing I see with your script is you have `id=event.source.text` but your if statement is `if len(spoolID)`. Does the text box have a binding to the text property? Where is the this script located? In the text box’s propertyChange event?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 14, 2021, 6:40pm UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712/3 "2021-05-14T18:40:52Z")

</div>

Try turning off ‘Reject Updates During Edit’

my propertyChange script:

```python
if event.propertyName == 'text':
	value = event.newValue
	if len(value) >= 10:
		table = event.source.parent.getComponent('Table')
		table.data = system.dataset.addRow(table.data, [value])
		event.source.text = ''

```

---

<div class="post-metadata">

**Author:** ![colin.bonner](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@colin.bonner](https://forum.inductiveautomation.com/u/colin.bonner)\
**Post date:** [May 18, 2021, 10:41am UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712/4 "2021-05-18T10:41:49Z")

</div>

Sorry, my bad. That was a typo.

Should have been:  
`spoolID = event.source.text`

---

<div class="post-metadata">

**Author:** ![colin.bonner](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@colin.bonner](https://forum.inductiveautomation.com/u/colin.bonner)\
**Post date:** [May 18, 2021, 10:43am UTC](https://forum.inductiveautomation.com/t/text-input-clear-text/46712/6 "2021-05-18T10:43:20Z")

</div>

Thanks, worked a treat. I would never have thought of that. 🙂
