New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizable repeated section iteration title #4117
Comments
Ideally, this would be a template within the "Section Settings" dialog. Should we have two labels, a "main" label and a label for iterations subtitles? Probably. Where would the label be stored? Maybe as a nested element: <fr:section ...>
<xf:label .../>
<fr:iteration-label>
<fr:param type="ExpressionParam">
<fr:name>cool</fr:name>
<fr:expr>42</fr:expr>
</fr:param>
</fr:iteration-label>
<fr:grid>
... The iteration label must also be localizable, which means it must be stored within resources. This means that Form Builder must be aware of it. |
Could we just have 1 label for the section (instead of |
In wizard mode, that might make sense. But in non-wizard mode, or for nested subsections, I was thinking that you might want to see the main title for the section and then individual subtitles for iterations. That might be overkill for now. But it remains that in effect, the label/title would function very differently in both cases if we have only one:
It is annoying that the label would evaluate in two different ways depending on how you decide to represent the sections. |
HTML support is required, like for any label/title. |
I am not sure to follow. Are you also thinking of introducing 2 levels of title for repeated sections? That is, you would have:
If what you have in mind, is it really necessary? |
It is not a necessary feature for now, in the sense that nobody is asking for it. But it follows conceptually from the notion that a title either evaluates in the context of a section, or in the context of an iteration. I don't like the idea that something evaluates differently depending on whether you enable a different appearance for top-level repeated section iterations. We don't have other places where expressions evaluate differently depending on an appearance or presentation. |
Just to make sure I understand this well, the question is whether repeated sections are shown to users as, option A:
Of just, option B:
How top level repeated sections show in the wizard could be an orthogonal question, but I'd say that it would be nice if we have the same capability there, i.e. if we go with option A, the wizard would show the two levels Children / Bart, Lisa. I like option A, but it adds more complexity (more UI). And if we go with option B, I don't really see an inconsistency in the way the XPath expressions in the label template are evaluated: if you have a single non-repeated section, XPath evaluates in the context of that section; if you have repeated sections, XPath evaluates in the context of the "current section" (which you can call iteration). Or am I missing something? |
Either way, it doesn't seem we can avoid having a specific construct to indicate the iteration label, as opposed to having only |
Steps:
|
Possible syntax after runtime transformation, using an <fr:section
id="my-repeated-section-control"
bind="my-repeated-section-bind"
repeat="content"
min="1"
iteration-label="xxf:r('my-repeated-section.iteration-label','fr-form-resources',map:merge(...))"
template="instance('my-repeated-section-template')">
<xf:label ref="$form-resources/my-repeated-section/label"/> or:
Another option is a nested element, but would it be any better? The main benefit I can see is ease of processing: |
In the wizard, do we still show the section label:
We could show the section label in the TOC and indent the iteration label below. Similarly, we could show both label and iteration label in the body. |
One issue now is how to get the iteration label in the wizard TOC. I started by evaluating Then I figured we could instead directly get the value of the iteration label, with:
but that doesn't work either, because Which raises the question of why we are using We should have an option, or another function, to obtain the values from the controls. We could also get the formatted values directly from the control. This is not the first time we have this issue, see:
|
With 2019.1, we have |
Thinking about it, it's not crazy that the Form Runner functions use bound nodes since all Form Runner controls have bindings, except maybe the "Explanatory Text" control, which works differently anyway (storing resources). What we heed here, that is, obtaining the value of an Now the The So in both cases, we get to One possibility is to allow passing |
Investigating that bug. We are using
Just after insert, But for After a further refresh, we don't have this problem. |
The reason is that when creating the new iteration, the This could be fixed if evaluating values was done in a different phase after evaluating bindings, since the Evaluating values could be done lazily, but we have to be careful because this depends on the XPath dependencies and that means that the state of dependencies must be ready. If it's during refresh anyway, that would be fine. Right? |
Ideally, we should have a more encompassing dependency system which would allow us to determine a partial evaluation order as we do for the bind variables now. But that is a larger change. For now, we'd like, ideally, a change which addresses this specific problem without introducing others. For example, we could decide that we split out the evaluation of bindings and that of values during refresh. This would be largely compatible with what we have now and, hopefully, only enable more scenarios which don't work right now, like the one in this bug. But this is also very limited: it only addresses issues where a control value depends on finding a control appearing in the same repeat iteration and using its binding. Very limited, but it would work. We could also make the evaluation of control values lazy. But we can only be a little bit lazy. We need to have the values evaluated before the refresh is done, otherwise values might change in unexpected ways: for example, refresh is done, model action runs and a function gets a control value, which evaluates at that time, and obtains the value from the data model, which might have changed since the last refresh. In this case, we could have surprising results, certainly ones that would be incompatible with what we have now. If we go the lazy way, we also need to check dependencies before any event is dispatched, so that we check the right state of dependencies. So we might have:
Differences with the first solution:
|
I worked on making the evaluation of value controls lazier. The problem I have now is that An easier solution is to remove the use of a variable for this purpose. |
Tentative fix is in. But there is another issue when reordering controls. |
Following #4064, this additional requirement is to provide more flexibility for the title of each repeated section, including:
+1 from customer
See also #3911 about the "Add" button label.
The text was updated successfully, but these errors were encountered: