problem using widgetVar property on p:commandButton

UI Components for JSF
Post Reply
mSephiroth
Posts: 47
Joined: 15 Mar 2010, 22:09
Location: Guatemala
Contact:

15 Dec 2010, 02:12

hello again,

I'm using de widgetVar property on a p:commandButton but when i combine the widgetVar and the ajax="false" property, the p:messages component doesnt show any messages. can someone confirm this issue.

My page:

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">


    <body>
        <ui:composition template="./../Templates/templateGeneralCORRECTO.xhtml">

            <ui:define name="head">
                Modificar mis datos - #{bundle.NombreColegio}
            </ui:define>

            <ui:define name="right">
                <ui:include src="/includes/PanelDerecho/PanelDerechoIndex.xhtml"/>
            </ui:define>

            <ui:define name="left">
                <ui:include src="/includes/AcercaDe_Index.xhtml"/>
                <h:form>
                    <p:menu model="#{MenuUsuarioMBean.obtenerMenuIndex(rolUsuarioLogueado)}"/>
                </h:form>
            </ui:define>
            <ui:define name="center">                
                <table width="100%" >
                    <tr >
                        <h:form>
                            <p:breadCrumb model="#{MenuUsuarioMBean.menuNavigateBar(
                                                   rolUsuarioLogueado,
                                                   null, null)}"/>
                        </h:form>
                    </tr>
                    <tr>
                        <p:outputPanel>



                            <h:panelGrid columns="1" columnClasses="columna-top" width="100%">
                                <h:form>
                                    <h:panelGroup id="messagePanel1" layout="block">
                                        <p:messages id="forCatedratico" />
                                    </h:panelGroup>
                                    <h1><h:outputText value="Datos basicos"/></h1>
                                    <h:panelGrid columns="3">

                                        <h:outputLabel value="* Nombres:" for="nombre" />
                                        <h:inputText id="nombre" value="#{UsuarioMBean.usuarioActual.nombre}" title="Nombre" required="true" requiredMessage="El Nombre es requerido." maxlength="#{bundle.UsuarioLongitudNombre}"/>
                                        <h:message for="nombre" errorStyle="color: red"/>

                                        <h:outputLabel value="* Apellido:" for="apellido" />
                                        <h:inputText id="apellido" value="#{UsuarioMBean.usuarioActual.apellido}" title="Apellido" required="true" requiredMessage="El Apellido es requerido." maxlength="#{bundle.UsuarioLongitudApellido}"/>
                                        <h:message for="apellido"  errorStyle="color: red"/>

                                        <h:outputLabel value="* AliasNick:" for="aliasNick" />
                                        <h:inputText id="aliasNick" value="#{UsuarioMBean.usuarioActual.aliasNick}" title="AliasNick" required="true" requiredMessage="El Alias del usuario es requerido." maxlength="#{bundle.UsuarioLongitudAlias}"
                                                     validatorMessage="El alias debe iniciar con alguna letra, contener solo letras, digitos o guiones bajos, y entre 8 a 24 caracteres sin terminar en guion bajo.">
                                            <f:validateRegex pattern="#{FormatosMBeans.obtenerPatternNick()}"/>
                                        </h:inputText>
                                        <h:message for="aliasNick" errorStyle="color: red"/>

                                        <h:outputLabel value="* Email:" for="email" />
                                        <h:inputText id="email" value="#{UsuarioMBean.usuarioActual.email}" title="Email" required="true" requiredMessage="El Email es requerido." maxlength="#{bundle.UsuarioLongitudMai}"
                                                     validatorMessage="La direccion de E-mail debe tener un formato valido.">
                                            <f:validateRegex pattern="#{FormatosMBeans.obtenerPatternEMail()}"/>
                                        </h:inputText>
                                        <h:message for="email" errorStyle="color: red"/>

                                        <h:outputLabel value="NumeroTelefono:" for="numeroTelefono" />
                                        <h:inputText id="numeroTelefono" value="#{UsuarioMBean.usuarioActual.numeroTelefono}" title="NumeroTelefono" maxlength="#{bundle.UsuarioLongitudTelefono}"/>
                                        <h:outputLabel/>

                                        <h:outputLabel></h:outputLabel>
                                        <h:outputLabel value="* Campo obigatorio" style="color: red"/>
                                        <h:outputLabel></h:outputLabel>
                                    </h:panelGrid>

                                    <p:commandButton id="cancelar" value="Cancelar"
                                                     action="#{UsuarioMBean.cancelarModificacion}"
                                                     immediate="true" ajax="false" image="ui-icon ui-icon-arrowreturnthick-1-w"/>

                                    <p:commandButton id="grabarDatos" value="Aceptar"
                                                     widgetVar="grabarDatos" ajax="false" onclick="grabarDatos.disable()"
                                                     action="#{UsuarioMBean.modificarMisDatosBasicos}"
                                                     image="ui-icon ui-icon-disk"/>

                                </h:form>

                                <h:form>
                                    <h1><h:outputText value="Cambiar password"/></h1>
                                    <h:panelGrid columns="3" >


                                        <h:outputLabel value="* Password:" for="password" />

                                        <p:password id="password" value="#{UsuarioMBean.usuarioActual.password}"
                                                    title="Password" required="true"
                                                    requiredMessage="El password es requerido."
                                                    maxlength="#{bundle.UsuarioLongitudPassword}"
                                                    minLength="7" level="2" promptLabel="Ingrese un password"
                                                    weakLabel="password inseguro" goodLabel="password bueno"
                                                    strongLabel="password fuerte"/>
                                        <h:message for="password" errorStyle="color: red"/>

                                        <h:outputLabel value="* Confirme Password:" for="passwordConfirmacion" />
                                        <h:inputSecret id="passwordConfirmacion" value="#{UsuarioMBean.passwordConfirmacion}" title="Password" required="true" requiredMessage="Debe confirmar el password." maxlength="#{bundle.UsuarioLongitudPassword}"/>
                                        <h:message for="passwordConfirmacion" errorStyle="color: red"/>
                                    </h:panelGrid>
                                    <p:commandButton id="cancelar" value="Cancelar"
                                                     action="#{UsuarioMBean.cancelarModificacion}"
                                                     immediate="true" ajax="false" image="ui-icon ui-icon-arrowreturnthick-1-w"/>

                                    <p:commandButton id="grabar" value="Aceptar" update="#{component.parent.clientId}"
                                                     onstart="grabar.disable()" ajax="false"
                                                     action="#{UsuarioMBean.modificarMiPassword}"
                                                     image="ui-icon ui-icon-disk"/>
                                </h:form>

                            </h:panelGrid>

                        </p:outputPanel>
                    </tr>
                    <tr >
                        <h:form>
                            <p:breadCrumb model="#{MenuUsuarioMBean.menuNavigateBar(
                                                   rolUsuarioLogueado,
                                                   null, null)}"/>
                        </h:form>
                    </tr>
                </table>

            </ui:define>

        </ui:composition>
    </body>

</html>

see the code

Code: Select all

<p:commandButton id="grabarDatos" value="Aceptar" update="#{component.parent.clientId}"
                                                     widgetVar="grabarDatos" ajax="false" onclick="grabarDatos.disable()"
                                                     action="#{UsuarioMBean.modificarMisDatosBasicos}"
                                                     image="ui-icon ui-icon-disk"/>
when I dont have the widgetVar property the messages show.
Glassfish 3.x, Mojarra 2.1.0 (FCS 2.1.0-b11), Netbeans 6.9, PF 2.2.1, Ubuntu 9.10

I will...never be a mere memory!!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests