Saeed
Saeed

Reputation: 926

How do I add a selected value to ice:selectOneMenu?

I'm facing a problem with the ice:selectOneMenu component in Icefaces..

In more details : When I fill the SelecItems arrayList I set an empty selcetItem at the first index in the arrayList, like that : mainClassificationsSI.add(new SelectItem(""));, and in My page I have the following :

    <ice:selectOneMenu partialSubmit="true" binding="#
        {editOutgoingBean.mainClassificationSelect}" id="mBookClass" value="#
        {editOutgoingBean.outgoing.main_Classification}" valueChangeListener="#      
        {editOutgoingBean.mainClassificationChanged}">

        <f:selectItems value="#{editOutgoingBean.mainClassificationsSI}"/>
    </ice:selectOneMenu>

First of all, I'm sure that the: editOutgoingBean.outgoing.main_Classification has value which is one of the values of selectItems in the SelectItems arrayList, but when the page is displayed, the Select tag select the empty value and it didn't select the value of the main_Classification I set before...

When I remove the first Empty SelectItem from the ArrayList, the Select tag will select the value that I set for main_Classification. Please help me find out what to do...

Upvotes: 0

Views: 3851

Answers (1)

Mudasar
Mudasar

Reputation: 249

try this ,may help you.

<ice:selectOneMenu partialSubmit="true" binding="#
    {editOutgoingBean.mainClassificationSelect}" id="mBookClass" value="#
    {editOutgoingBean.outgoing.main_Classification}" valueChangeListener="#      
    {editOutgoingBean.mainClassificationChanged}">
    <f:selectItem itemLabel="Select" itemValue="-1" />
    <f:selectItems value="#{editOutgoingBean.mainClassificationsSI}"/>
</ice:selectOneMenu>`

and don't the black select item from the bean as you were doing

Upvotes: 1

Related Questions