Sometimes you have a variable number of subcomponents of the form. a classical example is an order: an order consists of one to many different items. Every item might have a quantity and a name. I might expect the data type for this to look like:
data Item = Item{
quantity::Int,
itemName:: Text
}
data Order = Order {
...
items::[Item]
}
or maybe some new type wrapper around list, like newtype Multiple a = Multiple [a]
then I would expect the form to show one Item and then a button saying Add, when I press that I would expect one more item to appear below. I would also expect every item to have a delete button to remove it.
We wrote this manually in filocore, for those who have access:
Sometimes you have a variable number of subcomponents of the form. a classical example is an order: an order consists of one to many different items. Every item might have a quantity and a name. I might expect the data type for this to look like:
data Item = Item{ quantity::Int, itemName:: Text } data Order = Order { ... items::[Item]
} or maybe some new type wrapper around list, like newtype Multiple a = Multiple [a]
then I would expect the form to show one Item and then a button saying Add, when I press that I would expect one more item to appear below. I would also expect every item to have a delete button to remove it.
We wrote this manually in filocore, for those who have access:
https://github.com/glutamate/filocore/blob/7a40cba3fa4a8fcdf211efcada1e83209f5f5321/lib/Filocore/Strategy/Strategies.hs#L399-L414
https://cdn.diffusionkinetics.com/dkjs/form-repeat.js