1

I have an autoComplete field and, after selecting an object from it, I want to update some other fields. The p:inputText fields are updated, but I want to update a p:selectOneMenu field too, and this specific field is not updated at all. If I remove Primefaces Mobile RenderKit, it works perfectly, but this is a mobile project..

My view:

<h:form id="formCadastro">
<p:accordionPanel>      
    <p:tab title="Informações do Proprietário">
        <pm:field>
            <p:outputLabel for="proprietario" value="Nome:" />
            <p:autoComplete id="proprietario"
                            var="proprietario"
                            value="#{histopatologiaBean.histopatologia.proprietario}"
                            completeMethod="#{histopatologiaBean.completeProprietario}" 
                            itemLabel="#{proprietario.nome}"
                            itemValue="#{proprietario}" 
                            forceSelection="true"
                            converter="proprietarioConverter"
                            onfocus="this.setSelectionRange(0, this.value.length)" >
                <p:ajax event="itemSelect"
                        update="enderecoProprietario telefoneProprietario nomeAnimal" />
            </p:autoComplete>
        </pm:field>

        <pm:field>
            <p:outputLabel for="enderecoProprietario" value="Endereço:" />
            <p:inputText id="enderecoProprietario"
                         value="#{histopatologiaBean.histopatologia.proprietario.endereco}"
                         disabled="true"/>
        </pm:field>

        <pm:field>
            <p:outputLabel for="telefoneProprietario" value="Telefone:" />
            <p:inputText id="telefoneProprietario"
                         value="#{histopatologiaBean.histopatologia.proprietario.telefone}"
                         disabled="true"/>
        </pm:field>
    </p:tab>

    <p:tab title="Informações do Animal">
        <pm:field>
            <p:outputLabel for="nomeAnimal" value="Nome:" />
            <p:selectOneMenu id="nomeAnimal"
                             value="#{histopatologiaBean.histopatologia.animalAssociativa}"
                             converter="animalAssociativaConverter" style="width: 220px;">
                <p:ajax process="@this"
                        update="especie"
                        listener="#{histopatologiaBean.especieListener()}"/>
                <f:selectItem itemLabel="Selecione" itemValue="Não Informado" />
                <f:selectItems
                    value="#{histopatologiaBean.histopatologia.proprietario.animalAssociativa}"
                    var="animalAssociativa" itemLabel="#{animalAssociativa.nome}"
                    itemValue="#{animalAssociativa}" />
            </p:selectOneMenu>
        </pm:field>

        <pm:field>
            <p:outputLabel for="especie" value="Espécie:" />
            <p:inputText id="especie"
                         value="#{histopatologiaBean.histopatologia.animalAssociativa.especie}"
                         disabled="true"/>
        </pm:field>
    </p:tab>                    
</p:accordionPanel>

Any ideias?

  • 1
    Any version info? And please create an mcve, see [ask] – Kukeltje May 15 '15 at 07:48
  • I am facing the same issue. Did you ever get a resolution for this? – mvreijn Aug 12 '15 at 09:16
  • @mvreijn: same question to you... Version info? Hmmm I see this in your other question 5.2 – Kukeltje Aug 12 '15 at 13:19
  • @mvreijn I was using Primefaces 5.2. It is a bug in that version. I haven't tried with Primefaces 5.3, but I couldn't solve the problem. A workaround for this is replace the selectOneMenu for a commandButton and, after clicking in that button, show a dialog with a dataList in it. This dataList has the same values that the selectOneMenu would have. I did this and it worked like a charm. – Edylle Landy Nov 11 '15 at 13:57
  • @Edylle please see the accepted answer on my question, it contains a workaround: http://stackoverflow.com/q/31965296/1343553 – mvreijn Nov 11 '15 at 14:01
  • @mvreijn I didn't notice you already had a question about it. How have I never thought about using before? Thanks! – Edylle Landy Nov 11 '15 at 14:09

0 Answers0