Dynamic Form With Changing Fields Depending On User's Input

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

Does CakePHP have any functions that support this feature?

Thanks!

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.

1 Like

Thank you! This would give me a great start :slight_smile: