docassemble icon indicating copy to clipboard operation
docassemble copied to clipboard

Reusable fields

Open knod opened this issue 5 years ago • 2 comments
trafficstars

From what I understand, there isn't currently something similar to a template, but for fields instead of strings. That is, a way to abstract fields for reuse in the same way that we can currently abstract strings. A way to define a field in one spot and plug-and-play it into different questions.

That abstraction could be very useful, especially for making sharable packages. Does that functionality already exist? If not, would it be possible to implement?

knod avatar Dec 24 '19 19:12 knod

You could write functions that generate data structures for representing fields, and insert that code using code under fields: https://docassemble.org/docs/fields.html#fields%20code

The generic object feature can be used to reuse fields across different types of questions. https://docassemble.org/docs/fields.html#generic

jhpyle avatar Dec 24 '19 20:12 jhpyle

This would still be super useful to build a library of reusable questions, after seeing the limits of the fields->code method. Biggest limit being the need to specify the sets modifier on the question block.

nonprofittechy avatar Feb 03 '21 14:02 nonprofittechy

Closing this because of lack of activity.

jhpyle avatar Dec 03 '23 20:12 jhpyle