How to modify component group visibility based on other parameter ?

Answered

Comments

1 comment

  • Avatar
    wojciechka

    Usually this is done by setting show or canBeEdited for a <component> or <componentGroup> in <postShowPageActionList>. Setting canBeEdited to 0 causes the group and its children to be shown, but disallows editing them - so the user can see what he/she will install, but is not able to modify it without going back and changing install type to custom.

    Example below changes component selection and canBeEdited property for Parent and Children components based on ${installtype} value:

    <choiceParameter>
      <name>installtype</name>
      <!-- ... -->
      <postShowPageActionList>
        <if>
          <progressText>Modify component selection</progressText>
          <actionList>
            <componentSelection>
              <deselect>ChildB</deselect>
              <select>Parent,Children,ChildA</select>
            </componentSelection>
          </actionList>
          <conditionRuleList>
            <compareValues logic="equals" value1="${installtype}" value2="full" />
          </conditionRuleList>
          <elseActionList>
            <componentSelection>
              <deselect></deselect>
              <select>Parent,Children,ChildA,ChildB</select>
            </componentSelection>
          </elseActionList>
        </if>
        <if>
          <progressText>Modify editable</progressText>
          <actionList>
            <setInstallerVariable name="project.component(Parent).canBeEdited" value="1" />
            <setInstallerVariable name="project.component(Children).canBeEdited" value="1" />
          </actionList>
          <conditionRuleList>
            <compareValues logic="equals" value1="${installtype}" value2="custom" />
          </conditionRuleList>
          <elseActionList>
            <setInstallerVariable name="project.component(Parent).canBeEdited" value="0" />
            <setInstallerVariable name="project.component(Children).canBeEdited" value="0" />
          </elseActionList>
        </if>
      </postShowPageActionList>
    </choiceParameter>
    

    Note that values are not changed for children as setting either <show> or <canBeEdited> to 0 affects all of their children not being shown or editable.

Please sign in to leave a comment.