0

I want an input inside the p:dialog to be disabled until I open it, and when I close it, it needs to be disabled again.

I created a boolean variable in my bean and the input has disabled = boolean's value and it should work right. The button that opens the dialog has an action and an update attribute. In action I put the method that changes the boolean value, and in update the element I want to be updated (the input), but I get an exception:

java.lang.IllegalArgumentException: Intermediate identifier ventanaReserva in search expression ventanaReserva:gridReserva:usuario identifies a UIComponent that is not a NamingContainer

<h:form id="form" class="formulario">
...
<center><br/>
    <h:commandButton id="botonReserva" value="Reservar" onclick="PF('dlg').show();" 
      disabled="#{queryBean.noReservable}" action="#{queryBean.manejarApertura}" update=":form:nom :form:ventanaReserva:gridReserva:usuario" type="button" >
        <f:ajax execute="@this" render=":form:nom" />
    </h:commandButton> 

    <p:dialog id="ventanaReserva" header="Reservar oferta" widgetVar="dlg" focus="usuario" resizable="false">
        <p:ajax event="close" update=":form:nom :form:ventanaReserva:gridReserva:usuario" listener="#{queryBean.manejarCierre}" />
        <h:panelGrid id="gridReserva" columns="2" cellpadding="5">
            ...
            <h:inputText id="usuario" value="#{queryBean.usuario}" disabled="#{queryBean.inputUsuarioDesactivado}" /><br/>
            ...
        </h:panelGrid>
    </p:dialog>

    ...
</center>

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
AwesomeGuy
  • 537
  • 1
  • 6
  • 17
  • `p:dialog` is not a naming container. Instead of `:form:ventanaReserva:gridReserva:usuario`, you may try `:form:gridReserva:usuario` You may be interested in [this link](https://stackoverflow.com/a/8644762/4906586) – Al-un Dec 16 '17 at 12:05
  • @Al1 I'm getting a similar error `java.lang.IllegalArgumentException: Intermediate identifier gridReserva in search expression gridReserva:usuario identifies a UIComponent that is not a NamingContainer` – AwesomeGuy Dec 16 '17 at 12:07
  • How about `:form:gridReserva` alone? I wrote too fast, `h:inputText` is not a naming container neither. Please check the link I provided for more information – Al-un Dec 16 '17 at 12:09
  • @Al1 It works! Thanks! I'll check the link right now – AwesomeGuy Dec 16 '17 at 12:17

0 Answers0