1
0
-1

Is there a way in composer for me to change the label of a field, depending on what is selected in a drop down?

I cannot create a new field in this instance, and just apply hide/show rules and I'm also looking to the future for maintenance, and so was hoping to steer away from putting in static text widgets and hide or showing them depending on the selection.

Thanks,

Fiona

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      You can use a general business rule to update the caption using sfc.setCaptionText(noderef, plaintext).

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thank you both!

          CommentAdd your comment...
        1.  
          1
          0
          -1

          I don't think Composer supports dynamic content in field captions out of the box. I have seen people hide the standard field caption and place a Rich text above the field so that they can use floating fields to dynamically add the content of the drop down as described here:

          How to change contents of Text[Rich] dynamically? 

          There is a way to use floating fields in field captions but is it not exposed by the Composer editor and requires you to edit the Form Source XML manually (XML Source tab).

          1. Create a Rich Text field that has the dynamic content you require using floating fields.
          2. Edit the XML Source to copy the Floating Field definition from the rich text and paste it inside your target field definition.
          3. You can then manually add the $FLOAT{Title_link} tag to your field caption and you should then see the dynamic content.

          Example:

          <field name="Title" type="Field-DropDownList-Title" styles="styleset.size.medium">
              <setproperty name="label" value="Title"/>
          </field>
          <field name="xxx" type="Text-Rich">
              <setproperty name="label" value="$FLOAT{Title_link} X"/>
              <field name="Title_link" type="Field-FloatingField">
                  <setproperty name="linked.field" value="../../Title"/>
                  <setproperty name="empty.value" value=""/>
                  <setproperty name="empty.value.policy" value="always"/>
              </field>
          </field>
          <field name="MyField" type="Field-TextField" styles="styleset.size.medium">
              <setproperty name="label" value="$FLOAT{Title_link} X"/>
              <field name="Title_link" type="Field-FloatingField">
                  <setproperty name="linked.field" value="../../Title"/>
                  <setproperty name="empty.value" value=""/>
                  <setproperty name="empty.value.policy" value="always"/>
              </field>
          </field>

          Your result:

          Once satisfied, you can remove the rich text element from your form.

           

            CommentAdd your comment...