# TextField - disable after first entry?

**URL:** <https://forums.swift.org/t/textfield-disable-after-first-entry/64403>\
**Category:** Using Swift\
**Tags:** textfield, disable\
**Created:** [April 15, 2023, 1:13am UTC](https://forums.swift.org/t/textfield-disable-after-first-entry/64403 "2023-04-15T01:13:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghard123](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@ghard123](https://forums.swift.org/u/ghard123)\
**Post date:** [April 15, 2023, 1:13am UTC](https://forums.swift.org/t/textfield-disable-after-first-entry/64403/1 "2023-04-15T01:13:02Z")

</div>

I have a textfield that a user will enter a starting number in. How do I then ensure this field is locked, and the initial entry is retained please?

---

<div class="post-metadata">

**Author:** ![henrikac](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/henrikac/32/28038_2.png) [@henrikac](https://forums.swift.org/u/henrikac)\
**Post date:** [April 15, 2023, 8:57am UTC](https://forums.swift.org/t/textfield-disable-after-first-entry/64403/2 "2023-04-15T08:57:18Z")

</div>

I think this can be achieved with a combination of `@FocusState`, `.onChange(of:perform:)` and `.disabled(_:)` 🙂

---

<div class="post-metadata">

**Author:** ![ghard123](https://avatars.discourse-cdn.com/v4/letter/g/d9b06d/32.png) [@ghard123](https://forums.swift.org/u/ghard123)\
**Post date:** [April 16, 2023, 4:31am UTC](https://forums.swift.org/t/textfield-disable-after-first-entry/64403/3 "2023-04-16T04:31:49Z")

</div>

Thanks Henrik. I will give those a go.
