docassemble
docassemble copied to clipboard
Reusable fields
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?
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
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.
Closing this because of lack of activity.