Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Need help conditionally disabling row in SelectItem

    Hi guys, been looking around in the forums and selectitem/picklist docs but i'm probably more confused than when i started.

    Say i have a server-side datasource with an enum field:
    Code:
    <field name="language" type="enum" required="true" defaultValue="1">
                <title>
                    <fmt:message key="language"/>
                </title>
                <valueMap>
                    <value ID="0">
                        <fmt:message key="language.en"/>
                    </value>
                    <value ID="1">
                        <fmt:message key="language.se"/>
                    </value>
                    <value ID="2">
                        <fmt:message key="language.pl"/>
                    </value>
                    <value ID="3">
                        <fmt:message key="language.lv"/>
                    </value>
    ...more
                </valueMap>
            </field>
    I have a databound form with a SelectItem for that datasource field.

    I now need to disable (i.e. make a row not selectable) one or more values in the selectitem based on some other, external criteria, i.e i can't set it directly in the datasource file.

    Is there a way for me to conditionally add for example a criteria, in pseudocode "if ID=3 disable" or similar?

    I hope i am explaining my use case good enough. Cheers

    #2
    A valueMap is just a key <-> value mapping, there's nowhere to add additional data. So if you want to do anything that is per-value, you just make it into an optionDataSource, then you can add disabled markers, find pairings by criteria, etc.

    Comment


      #3
      Right. thanks.

      Comment

      Working...
      X