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 `maxlength` attribute to any `_fields` methods #852

Closed nonprofittechy closed 4 months ago

nonprofittechy commented 4 months ago

@mnewsted I'm opening this up as a draft PR for now, LMK if the API makes sense.

mnewsted commented 4 months ago

Thanks @nonprofittechy ! I appreciate you adding this to a host of _fields methods.

If I understand correctly, will just add the maxlength=# attribute inside a function call, like users[i].name_fields(person_or_business='unsure', maxlength=40) ? And it applies to all internal fields, in this case (first, middle, last, and business name?

nonprofittechy commented 4 months ago

It would look like this:

users[0].name_fields(maxlength={"first": 40, "last": 32})

mnewsted commented 4 months ago

That's even better. The ability to customize length on a field-by-field basis = chef's kiss.