0

I have a <p:selectOneMenu> on my page, it receives a map for its values:

                    <p:selectOneMenu style="width:160px;  float:right;"
                        value="#{aba.ln}" rendered="#{aba.selecaoAtiva}">
                        <f:selectItems value="#{aba.itens}" />
                        <p:ajax update="@form" event="change" />
                    </p:selectOneMenu>

It is rendering the following HTML for the select:

<select name="j_idt72:j_idt73:j_idt77_input" id="j_idt72:j_idt73:j_idt77_input">
    <option selected="selected" value="71xxxxUG">LABEL ONE</option>
    <option value="71yyyyUG">LABEL TWO</option>
</select>

but the ajax is sending the LABELS to the backing bean.


After fiddling a while, i removed the event="change" from the <p:ajax>, and it started passing values again.

So, question is, why having <p:ajax update="@form" event="change" /> sends labels to the backing bean, while <p:ajax update="@form" /> sends the values?

Mindwin Remember Monica
  • 1,469
  • 2
  • 20
  • 35
  • possible related question: http://stackoverflow.com/questions/7022965/why-selectonemenu-send-itemlabel-to-the-converter – Mindwin Remember Monica Oct 11 '12 at 15:19
  • Do you have a `@FacesConverter(forClass)` for this class? If so, then it's broken. – BalusC Oct 11 '12 at 15:56
  • Nope. no converter @BalusC (that I know of). the behavior of the ajax call is: with event="change" it passes the labels, without it passes values (as expected). both labels and values are Strings. When I get to work on monday, I will post the backing bean code. – Mindwin Remember Monica Oct 12 '12 at 22:06
  • I'd report it to PrimeFaces guys. The default event for `UIInput` components is by the way `valueChange`. – BalusC Oct 12 '12 at 23:59

0 Answers0