# Dynamic Form With Changing Fields Depending On User's Input

**URL:** <https://discourse.cakephp.org/t/dynamic-form-with-changing-fields-depending-on-users-input/8926>\
**Category:** Uncategorized\
**Created:** [January 29, 2021, 7:49pm UTC](https://discourse.cakephp.org/t/dynamic-form-with-changing-fields-depending-on-users-input/8926 "2021-01-29T19:49:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xyhuang](https://avatars.discourse-cdn.com/v4/letter/x/e9c0ed/32.png) [@xyhuang](https://discourse.cakephp.org/u/xyhuang)\
**Post date:** [January 29, 2021, 7:49pm UTC](https://discourse.cakephp.org/t/dynamic-form-with-changing-fields-depending-on-users-input/8926/1 "2021-01-29T19:49:45Z")

</div>

Hi everyone,

I’m trying to create a dynamic form whose fields change depending on their current selections.  
For example the “inprint”, “E-book”, and “Online-database” options yield slightly different form fields: [https://www.citationmachine.net/apa/cite-a-book/custom](https://www.citationmachine.net/apa/cite-a-book/custom)

Does CakePHP have any functions that support this feature?

Thanks!

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [January 29, 2021, 8:10pm UTC](https://discourse.cakephp.org/t/dynamic-form-with-changing-fields-depending-on-users-input/8926/2 "2021-01-29T20:10:06Z")

</div>

This sort of thing is done with JavaScript. Cake outputs HTML, which can include any JavaScript that you care to write. What would be required to do something like this varies hugely depending on what JS framework you want to use, and there’s no way to cover all of them in a generic fashion. So, Cake doesn’t even try, but it also doesn’t get in your way at all for writing your own JS. I believe there are some framework-specific CakePHP plugins (e.g. jQuery, Bootstrap) that may be useful, and certainly many JS tutorials out there that you can import solutions from.

---

<div class="post-metadata">

**Author:** ![xyhuang](https://avatars.discourse-cdn.com/v4/letter/x/e9c0ed/32.png) [@xyhuang](https://discourse.cakephp.org/u/xyhuang)\
**Post date:** [January 29, 2021, 8:12pm UTC](https://discourse.cakephp.org/t/dynamic-form-with-changing-fields-depending-on-users-input/8926/3 "2021-01-29T20:12:45Z")

</div>

Thank you! This would give me a great start 🙂
