dillonkearns / elm-form

Standalone version of the elm-pages Form API.
Other
19 stars 6 forks source link

Accept dynamic length of fields #5

Open brzezinskip opened 1 year ago

brzezinskip commented 1 year ago

Hi! I've ran into a usecase that perhaps would be beneficial for others to have too.

I have a form on my site, that user can dynamically add/remove elements from/to. Let's say single elements type would be something like this:

type alias Bar = {
  id: Int,
  memo: String,
  isOk: Boolean
}

It'd be great if it was possible to compose the Form out of N of such elements but still be able to validate them one by one. For example, each element needs to have a memo, otherwise whole form is in invalid.

Hope this explanation makes sense, please let me know if I can help somehow/provide more details.

Thank you so much!

aszenz commented 1 year ago

I come across this use case quite often as well. Example being invoice with multiple invoice lines