Pomax / use-models-for-data

Work with your data through well-defined, always-consistent models, instead of rando plain JS objects
4 stars 0 forks source link

Add a `form` helper to the __meta object to guide form generation #18

Open Pomax opened 2 years ago

Pomax commented 2 years ago

Specifically:

__meta = {
  form: [
    {
      heading: <string or false, default to false>,
      controls: {
        save: <string for saving the form>,
        cancel: <string for resetting>
      }
      collapsible: <boolean, default to false>,
      collapsed: <boolean, default to false>,
      descriptions: <boolean, default to true>,
      fields: [<one or more var names, in the order they should appear on the form>],
    }
  ]
}

Note that if there is a __meta.form, any fields not mentioned in the form array will not end up in the actual form markup.

Pomax commented 2 years ago