# Clear Text Field in perspective

**URL:** <https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299>\
**Category:** Ignition\
**Created:** [May 4, 2021, 8:01am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299 "2021-05-04T08:01:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [May 4, 2021, 8:01am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/1 "2021-05-04T08:01:28Z")

</div>

Hi,  
I want to clear Text field on enter key press. On key down event If keycode is 13 then I am clearing text field.(like self.props.text=" ") But It is not working.  
I am using textfield for barcode scan step. If there are two consecutive barcode step and I have entered value for 1st step and on enter key down it executes and gets complete but textfield not clearing and it takes same value for next step.  
How can I do this, Any Idea?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 4, 2021, 9:32am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/2 "2021-05-04T09:32:38Z")

</div>

Maybe try adding key code 10,line feed, or use a print statement to print out the key code that’s being pressed so you can see what’s going on. Note that print will go to the wrapper.log. system.perspective.print will go to the browser’s console

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [May 4, 2021, 11:53am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/3 "2021-05-04T11:53:53Z")

</div>

I have printed keycode in wrapper.log and getting 13 value.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 4, 2021, 11:55am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/4 "2021-05-04T11:55:27Z")

</div>

Can you post the code you’re using? Make sure to enclose in 3 backticks (`, the key left of the ‘1’ key) or just use the preformatted text button ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f44a9cfb532a86e19a304b59e05340a1cd7cbda0.png)

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [May 4, 2021, 11:58am UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/5 "2021-05-04T11:58:48Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/14150a4cd0828cd77c92ef616f2374e42a97916b.png)

I am doing like this.

---

<div class="post-metadata">

**Author:** ![Ahmad\_Mohamadi](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Ahmad\_Mohamadi](https://forum.inductiveautomation.com/u/Ahmad_Mohamadi)\
**Post date:** [June 6, 2022, 2:51pm UTC](https://forum.inductiveautomation.com/t/clear-text-field-in-perspective/46299/6 "2022-06-06T14:51:28Z")

</div>

You must set “rejectUpdatesWhileFocused” property to false. When pressing the enter key, the text filed is focused and that will block any update on it. Therefore, by setting “rejectUpdatesWhileFocused” to false, you will allow the updates to be enforced on the components even when they are focused.
