orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
518 stars 220 forks source link

Reusable controls / control templates / validations #766

Open ebruchez opened 11 years ago

ebruchez commented 11 years ago

Say you have a Yes/No selection you need to use in many place in your form. You shouldn't have to re-create the itemset every time.

Possibilities (non-exclusive):

evlist commented 10 years ago

I have the problem for a customer who fetches common itemsets from a database (countries, salutations, ...). Wouldn't a simple solution be an option to "reuse" the same itemset than another control?

avernet commented 10 years ago

It would be possible. But what if you delete that other first control with the "master" itemset? Would the other controls that were referring to that itemset become "itemsetless", or should we migrate the itemset to one of the remaining controls?

I think it would make more sense to have such itemsets defined independently of the control (through something in the left sidebar), and then allow a control to reference such an itemset instead of entering it inline.

ebruchez commented 10 years ago

Yes and in fact we might soon implement, as par of work for a customer, a mechanism in the XForms engine to define itemsets completely independently from controls. This could be a basis for this feature.

evlist commented 10 years ago

@avernet : we could have a warning message asking what to do but I agree that this looks like a hack... @ebruchez : another more generic option would be to allow to define control templates (like we have section templates). In that case that wouldn't be the itemset that would be shared but the definition of the select or select1 (or any other control). By convention any form called "library" can be used as a set of section templates and we could say that all the controls within a section called "library" or "controls" in this form would be considered as control templates in the same way. That would be useful not only for select and select1 but also for any control with complex XPath expressions or whatever needs to be shared to facilitate form maintenance.

ebruchez commented 8 years ago

I am extending this RFE to controls beyond selection controls. For example, we want to add a "Regular Expression" common constraint. Say you worked on that constraint on a specific control. Now it makes sense to be able to reuse that, in the current form or between forms.

One idea would be to be able to take any control and say "save to library". The library could be:

It would make sense to be able to store that in the current library forms for the app/global cases. Right now we only store complete sections there.

Implementation ideas:

Q: How would we make a distinction, in the library form, between sections to expose as section templates, and other sections? Maybe we would create a special section at the beginning, which would be used to store these custom controls.

ebruchez commented 8 years ago

We now have a "Yes/No Answer" control, so that one is taken care of. But we have another +1 from evaluator for a generic solution.

avernet commented 7 years ago

+1 from evaluator

ebruchez commented 7 years ago

What this would be useful for:

ebruchez commented 7 years ago

It would be nice if we could add a component to the library directly from a form definition. But this should also be the case with section templates. So we can make that a P2.

As a first step, we can do this in the acme/library and orbeon/library forms. A special section would contain controls, each of which would become its own XBL component.

Steps:

avernet commented 7 years ago

+1 from user

ebruchez commented 6 years ago

+1 from customer

ebruchez commented 6 years ago

+1 from evaluator

ebruchez commented 2 years ago

Reviewing this, it does seem that the library forms are a possible place for that. A "library" can contain section templates, but also reusable components.

This opens some questions:

Items to include in the component:

ebruchez commented 2 years ago

There could be multiple sections, or sub-sections, of custom controls, in the library form. This would allow grouping the controls under headings in the toolbox.

ebruchez commented 2 years ago
avernet commented 1 year ago

+1 for reusable validation, so if a given validation rule is used on several fields, possibly across forms, and the requirement for this validation changes, the change only needs to be done in a single place, to save time and potential mistakes.

+1 from customer

ebruchez commented 2 months ago

Another use case: Currency control, set currency prefix, for example GBP, and make it a reusable control with that specific currency.

Although for that use case, could we imagine a currency directly configurable from the toolbox? Or, for selected controls a quick configuration at the top of the Form Builder form area or toolbox?

ebruchez commented 2 months ago

+1 from customer