# Formtools (ftType:state)

**URL:** <https://discourse.farcrycore.org/t/formtools-fttype-state/1713>\
**Category:** support\
**Created:** [September 2, 2021, 6:36am UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713 "2021-09-02T06:36:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asimkon](https://discourse.farcrycore.org/letter_avatar_proxy/v4/letter/a/c6cbf5/32.png) [@asimkon](https://discourse.farcrycore.org/u/asimkon)\
**Post date:** [September 2, 2021, 6:36am UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/1 "2021-09-02T06:36:38Z")

</div>

I would like to ask which specific content type cfc (entire file syntax) if possible, i could use with the formtool ftType [state](https://github.com/farcrycore/core/blob/master/packages/formtools/state.cfc). It would help me a lot to build an interactive fields form as i am beginner and thus can not figure out what is happening with formtools types, values and getstates function.  
According to your farcry book display and edit functions along with default edit.cfm are obvious. Some reverse code engineering in this context definitely would help me a lot!

Regards

---

<div class="post-metadata">

**Author:** ![jeff](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/jeff/32/1174_2.png) [@jeff](https://discourse.farcrycore.org/u/jeff)\
**Post date:** [September 2, 2021, 3:55pm UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/2 "2021-09-02T15:55:33Z")

</div>

Personally I just create my own states and countries methods in a helper cfc and allow it to be returned as an optional array of structs or a query. Super simple to make.

Once in place, I can use it for custom formtools (dropdowns, etc) as well as frontend website needs (I just write a quick array function/closure to search the data, or you could write a simple QoQ).

However, if you want to stick with the builtin state formtool, you could just talk directly to the state object itself and do something similar with that.

---

<div class="post-metadata">

**Author:** ![asimkon](https://discourse.farcrycore.org/letter_avatar_proxy/v4/letter/a/c6cbf5/32.png) [@asimkon](https://discourse.farcrycore.org/u/asimkon)\
**Post date:** [September 3, 2021, 5:44am UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/3 "2021-09-03T05:44:15Z")

</div>

Thanks for your concise post but unfortunately i am at beginner’s level.

If you could provide with a specific github example (first method), it would help me a lot especially not to do any errors. I would be interested also to find out (second method), as it was my initial query.  
The more i learn, the more i become addicted with Farcry framework.

Regards

---

<div class="post-metadata">

**Author:** ![jeff](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/jeff/32/1174_2.png) [@jeff](https://discourse.farcrycore.org/u/jeff)\
**Post date:** [September 3, 2021, 11:34pm UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/4 "2021-09-03T23:34:47Z")

</div>

Here you go:

1. [https://gist.github.com/jeffcoughlin/9ce9b2e1f29aaf03c967b12753192971](https://gist.github.com/jeffcoughlin/9ce9b2e1f29aaf03c967b12753192971)
2. For the second one, just create the object to point to the formtool and talk directly to the methods.

Note: The example getStates() method I use there is for US only. If you want to parse states based on country, you’ll want to factor that data in a little differently (maybe just use the country as a filter for the method and return the appropriate data that way).

---

<div class="post-metadata">

**Author:** ![asimkon](https://discourse.farcrycore.org/letter_avatar_proxy/v4/letter/a/c6cbf5/32.png) [@asimkon](https://discourse.farcrycore.org/u/asimkon)\
**Post date:** [September 6, 2021, 6:05am UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/5 "2021-09-06T06:05:58Z")

</div>

Thanks for your great assistance via the detailed example!

One more question, how do i fetch country value in order to use it as a filter for getStates().

Regards

---

<div class="post-metadata">

**Author:** ![seancoyne](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/seancoyne/32/1177_2.png) [@seancoyne](https://discourse.farcrycore.org/u/seancoyne)\
**Post date:** [September 6, 2021, 8:20pm UTC](https://discourse.farcrycore.org/t/formtools-fttype-state/1713/6 "2021-09-06T20:20:22Z")

</div>

If you were to use the built in state & country formtools you could add a ftWatch=“country” to the state field and it would update the list when you change the country. you could override the built in ones in your project if you needed different countries and/or states.
