ihp icon indicating copy to clipboard operation
ihp copied to clipboard

Add field functions for multi-records forms

Open wout opened this issue 3 years ago • 3 comments

Working with multi-record forms is a bit tedious. It's either stick with the defaults (e.g. single-record forms) or write everything by hand.

I would like to propose a middle ground with a set of functions for form fields that accept a record as an argument. It will make writing multi-record forms less verbose and more DRY.

The way I see this would be by adding functions for all existing field variants but with a For suffix, for example:

  • {textFieldFor page #title}
  • {numberFieldFor product #quantity}
  • {selectFieldFor portfolio #projectId allProjects}
  • ...

wout avatar Sep 07 '22 07:09 wout

Just ran into a situation where this is exactly what I could use as well.

stephenbenedict avatar May 15 '23 12:05 stephenbenedict

There's a prototype of this in the ihp-multi-records-form-example repo https://github.com/digitallyinduced/ihp-multi-records-form-example/blob/main/Web/View/Tasks/New.hs It requires latest master IHP. If you check out that repo you can give it a try :)

mpscholten avatar May 15 '23 15:05 mpscholten

I just saw that. Will check it out. Thanks!

stephenbenedict avatar May 16 '23 01:05 stephenbenedict