form as a table? store to a json column?
To explain with an example, I have a small (4) list of products.
I have an InvoiceResource to capture the customer details, etc. For adding the ordered items (products), we don't want a repeater field, but want to display all products in a table and provide text input next to the products / rows for entering the quantity. Each item will have a default quantity of 0, and the user will update the needed quantity accordingly. (Some rows can remain as zero quantity) - basically the old school way of creating a form table. Once the 4 rows are filled, I would like to store the item name & quantity into a json column. I looked into the documentation. Looks like the repeater field won't help here. Please correct me & guide me on how to do it with a repeater field? (an easier, quicker, cleaner approach) PS: I am tending towards creating a custom field for this. Note: 4 products can become 6 later. So it has to be dynamic
I have an InvoiceResource to capture the customer details, etc. For adding the ordered items (products), we don't want a repeater field, but want to display all products in a table and provide text input next to the products / rows for entering the quantity. Each item will have a default quantity of 0, and the user will update the needed quantity accordingly. (Some rows can remain as zero quantity) - basically the old school way of creating a form table. Once the 4 rows are filled, I would like to store the item name & quantity into a json column. I looked into the documentation. Looks like the repeater field won't help here. Please correct me & guide me on how to do it with a repeater field? (an easier, quicker, cleaner approach) PS: I am tending towards creating a custom field for this. Note: 4 products can become 6 later. So it has to be dynamic
1 Reply
The quickest way to have a "table as form field" is probably #awcodes-table-repeater
In the repeater, you can use a mix of form fields and
View
components to display static information as columns
If you need something more custom, it's probably best to just create a custom field, as you're considering