Split existing form into tab


#1

Hey guys,

I have a quite big form which is created dynamically and is growing more and more. Is there any way to seperate this form into different tabs without having a few forms with a SAVE button each?

Thanks for any hints!


#2

Hi, there are some options, and also a way to improve things for everyone. I’ll describe here:

  1. A form can reside in multiple tabs, and that is demonstrated in http://ui.agiletoolkit.org/demos/field2.php. It does not use a model, but you should be able to use set it with form->setModel($m, false) then pick individual fields with form_page->addField('myfield')

  2. Technically, I think tab can be inside the Layout too, so creating a “FormLayout\Tabs” similar to https://github.com/atk4/ui/blob/develop/src/FormLayout/Columns.php might be possible, which would result in an automated layout (handy for the CRUDs).

  3. As of 1.4.3 the CRUD component is now much more configurable and well documented. You can check out https://github.com/atk4/ui/releases/tag/1.4.3 and docs on using custom form: http://agile-ui.readthedocs.io/en/latest/crud.html?highlight=crud#custom-form

Let us know if this helps you.


#3

Here is also the ticket for implementation of the Multi-Tab form layout: https://github.com/atk4/ui/issues/396 if anyone is interested at coding (or sponsoring) it.


#4

This is just what I was looking for! Great, thank you!

Also added a PR regarding this to have it a bit easier to switch an already existing form