1
<h:outputText value="#{subtech.technology.get(0).name}"
                rendered="#{not subtech.selected}" />
            <ace:selectMenu value="#{subTechBean.selTechnology}" 
                rendered="#{subtech.selected}">
                <f:selectItems value="#{subTechBean.technology}"></f:selectItems>
            </ace:selectMenu>

when I switch the value of selected to true using change buttons selectmenu appears.but with no value is pre-selected and if I didn't set the value and use the save button to see the outputtext,then the page shows •{0}: Validation Error: Value is not valid.

how to save the default value of selectMenu,so if I didn,t change the value it will use the default value.

1 Answers1

0

You can see an example of properly setting the ace:selectMenu value here: http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=selectMenuBean

If you wanted a default value before the user selected one, then in that example you could set a default value for the field in SelectMenuBean.

Christian Wilkie
  • 3,693
  • 5
  • 34
  • 49
  • Have you actually tested that? I try to set a default value in a `ace:selectMenu` in its `value` attribute, but it is not shown. Unfortunately, the ICEFaces showcase do not have an example of how to specify the default value. For the older `ice:selectOneMenu` setting the default value did work like that. – gogognome Nov 22 '22 at 09:37
  • After some further investigation it turns out that there is a bug in `ace:selectMenu` (at least in ICEFaces 3.3.0). The default value of the select menu can be specified with the `value` attribute. However, if the last select item is the default value, then it is not shown as default value. A workaround for this bug is to add an empty select item at the end, like this: `` – gogognome Nov 22 '22 at 09:43