# Perspective Text Field bidirectional binding corner case bug

**URL:** <https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719>\
**Category:** Ignition\
**Created:** [April 21, 2022, 8:16pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719 "2022-04-21T20:16:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [April 21, 2022, 8:16pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719/1 "2022-04-21T20:16:19Z")

</div>

Weird corner case I just bumped into while testing some code to sanitize user input:

- Setup a Text Field in a Perspective view with a bidirectional binding on it’s text property from another view property
- Enter some text like `xxx` in the box and see the bound property is updated as expected when the text field loses focus (👍)
- Click back on the text field and add some whitespace at the beginning/end of the string (i.e. ` xxx `), and the bound property is NOT updated when the text field loses focus even thought the text property on the text field component is updated (👎)
- Go back to the text field and change any of the `x` characters, and the bound property is updated with the new value including beginning/end whitespace when the text field loses focus (👍)

Seems to me that even though the bidirectional binding will copy the leading/trailing whitespace, the logic that decides “has the value changed to trigger the binding” _ignores_ changes in leading/trailing whitespace.

I feel like it shouldn’t be possible to get a bidirectionally bound pair of properties out of sync like that. This seems to require the Perspective Text Field to happen. I couldn’t make a similar failure happen between two properties that were not part of a text field.

Saw this on 8.1.13.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 21, 2022, 8:22pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719/2 "2022-04-21T20:22:54Z")

</div>

I’m not able to readily reproduce on 8.1.17; maybe this is a bug we fixed?

[https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e02984e1ff9df186d354a9a8e6dcca75bd6d9304.mp4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e02984e1ff9df186d354a9a8e6dcca75bd6d9304.mp4)

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [April 21, 2022, 8:26pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719/3 "2022-04-21T20:26:14Z")

</div>

Just tried that setup in 8.1.13 and it also works for me.  
Lemme try if I can narrow down what is different.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [April 21, 2022, 8:30pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-bidirectional-binding-corner-case-bug/58719/4 "2022-04-21T20:30:26Z")

</div>

Never mind. I’m dumb.

It was a side effect of the way my sanitizing script was behaving. I was sure I had disabled it, but I hadn’t.

We’re good. Thanks for the super quick response.
