# Format Text Field

**URL:** <https://forum.inductiveautomation.com/t/format-text-field/44347>\
**Category:** General Discussion\
**Created:** [March 11, 2021, 3:47am UTC](https://forum.inductiveautomation.com/t/format-text-field/44347 "2021-03-11T03:47:40Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 12, 2021, 5:01pm UTC](https://forum.inductiveautomation.com/t/format-text-field/44347/8 "2021-03-12T17:01:21Z")

</div>

It looks like this did the trick for OP:

> [@phoneNumber Validation](http://forum.inductiveautomation.com/t/phonenumber-validation/44248/8):
>
> I used a text field to enter phone numbers. I used a change script, right click on text property add change script. This is my script, it’s not the best and could probably be better, but did what I wanted: import phonenumbers import re x = currentValue.value regex = "^\(?\d{3}\)?[-]?\d{3}[-]?\d{4}$" if re.search(regex,x): z = phonenumbers.parse(x, "IN") if phonenumbers.is\_valid\_number(z): x = phonenumbers.format\_number(phonenumbers.parse(self.props.text, 'US'), phonenumbers.PhoneNumb…

---

_[View the full topic](https://forum.inductiveautomation.com/t/format-text-field/44347)._
