Hi,
I would like to change the labels of a section dynamically based on what the user selected in the form (the user is using a wizard view). Is this possible to do ? I was thinking of creating a custom xf:action that would update the label as the section changes. I was able to change the value of an input using this code : <xf:action event="xforms-ready"> <xf:setvalue ref="//mycontrol">working</xf:setvalue> </xf:action> However, it does not work for sections. I am also unable to change the label dynamically of an input field. Is this possible to do also ? Thank you ! |
Administrator
|
Hi Frederic,
A couple of questions: - And is this in the context of a form you created with Form Builder? I.e. you'd like to programmatically change the label of a section, which normally is just entered in Form Builder itself? - Is your form available in multiple languages, or do you have just 1 language? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
- And is this in the context of a form you created with Form Builder? I.e. you'd like to programmatically change the label of a section, which normally is just entered in Form Builder itself?
Yes, we want to have a generic label and change it only for a certain scenario in the form - Is your form available in multiple languages, or do you have just 1 language? Yes (just 2 languages though and it won't grow) |
Administrator
|
Hi Frederic,
Got it; so, you could, editing the source of the form in Form Builder: 1. Find the <xf:instance> with id="fr-form-resources". In this instance, remove the xxf:readonly="true", so you can programmatically change the content of that instance. 2. Set the value with code along these lines (here assuming this is triggered by a button named `set-label`, and that the control you're setting the label of is named `my-control`. <xf:action observer="set-label-control" event="DOMActivate"> <xf:setvalue ref="instance('fr-form-resources')/resource[@xml:lang = 'en']/my-control/label" value="'My value'"/> </xf:action> You'll let us know if this works for you, Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Great that makes sense to modify the resource directly ! I guess I can do the same thing for Ouput Control if I want to change the default label based on a reply from a web service ?
I was trying to modify the label field using xpath instead of accessing the resource. Would it be possible to do it this way instead (I am just curious ) ? |
Administrator
|
Hi Frederic,
Yes, you can change the label (as well as the hint, help, and alert) for any control using the same technique. What do you mean by "modify the label field using xpath instead of accessing the resource"? In the `xf:setvalue`, you point to what you want to change using an XPath expression (e.g. `instance('fr-form-resources')/resource[@xml:lang = 'en']/my-control/label`), and the value you want to set using another XPath expression, which in the above example was just a string (`'My value'`). Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex - I can see that the label in the wizard tree/toc is picked from the top level section labels. Is there a way to keep wizard tree/toc labels unique as supposed to picking the label from top level section labels?
-- For ex: Top level section label is 'Transport' but I want wizard tree/toc label as 'Travel arrangements' Cheers On Friday, September 16, 2016 at 6:33:13 AM UTC+8, Alessandro Vernet wrote: Hi Frederic, You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/197d649a-c366-4595-904f-3a1cf7c52a0co%40googlegroups.com. |
Hi Alex - Have you had a chance to look into this?
-- On Thursday, June 25, 2020 at 9:17:13 AM UTC+8, Mani wrote:
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/835b02a7-2966-4cb2-bc53-58b5c0b2d340o%40googlegroups.com. |
Administrator
|
Hi Manish,
I'm sorry for the delay! But I'm not following: if you'd like you wizard section to be named "Travel arrangements", why not name your top-level section in Form Builder "Travel arrangements"? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1593820474053-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
I have a scenario where they need to be different. Can they both be independent of each other? On Sat, 4 Jul 2020, 07:54 Alessandro Vernet, <[hidden email]> wrote: Hi Manish, You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/CAN39TsO6eZ%3DjHfEA8J3G04v6fiE-KdFgi9WOfa76cjTy40EWUw%40mail.gmail.com. |
Administrator
|
Hi Manish,
Can you share more details about your use case? I am not picturing what you mean by different top-level sections and top-level wizard sections; in the wizard mode, the top-level sections are the top-level wizard sections. Maybe a realistic example of what you're shooting for would help. ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1594080232257-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
Hi Manish,
Have you found a way to name the wizard section the way you wanted? If not, could you help me understand what the situation is, per my earlier message? ‑Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1594658896913-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |