SuffolkLITLab / docassemble-AssemblyLine

Quickly go from a paper court form to a runnable, guided, step-by-step web application powered by Docassemble. Swap out branding and pre-built questions to meet your needs.
https://suffolklitlab.org/docassemble-AssemblyLine-documentation/
MIT License
41 stars 5 forks source link

Add an optional parameter to the _fields() methods to specify if each field is required or optional #853

Open nonprofittechy opened 4 months ago

nonprofittechy commented 4 months ago

Something like:

required={"last": False}

If the key isn't present in the provided dictionary, it should respect the default required value. E.g.,

for k in required:
  if k in fields:
    fields[k]["required"] = required[k]

This starts to make the _fields methods a complex way to interact with what are pretty basic fields to write out by hand, but consistency and a single API throughout the interview has value.