Messages with display mode tooltip fail

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
metadata
Posts: 9
Joined: 16 Mar 2015, 16:53

12 May 2017, 10:50

Hi

The fields with tooltip messages do not go red when an ajax error is thrown in the postValidate event.

We are using PF 6.1

Code: Select all

<h:form id="formDetalle" >    
     <p:tooltip position="bottom"/>
     <p:panelGrid columns="2" layout="grid" columnClasses="ui-g-12 ui-md-3,ui-g-12 ui-md-9">
            <p:outputLabel for="email" value="email"/>
             <h:panelGroup >
                   <p:inputText id="email" value="#{usuarioDetalle.usuario.email}" disabled="#{disableCampos}"/>                                              
                   <p:message for="email" display="tooltip" />                                                               
                  <f:event listener="#{usuarioDetalle.validarEmail}" type="postValidate" />           
            </h:panelGroup>  
    </p:panelGrid>                          
     <p:commandButton id="btnGuardar" value="Guardar" update="@form" actionListener="#{usuarioDetalle.guardar}" icon="fa fa-check"/>                                                                       
 </form>
 

Code: Select all

public void validarEmail(ComponentSystemEvent event) {
            FacesContext fc = FacesContext.getCurrentInstance();
            FacesMessage msg = new FacesMessage("Ya existe un usuario registrado con este mail");
            msg.setSeverity(FacesMessage.SEVERITY_ERROR);
            fc.addMessage("formDetalle:email", msg);
            fc.renderResponse();
}
 

Normal validation works
Image

Validation in event postValidate fails (It does not turn red)
Image
Last edited by metadata on 12 May 2017, 18:23, edited 4 times in total.

metadata
Posts: 9
Joined: 16 Mar 2015, 16:53

12 May 2017, 14:36

Sorry, but I forgot to say the version of Primefaces we are using.

We are using PF 6.1

metadata
Posts: 9
Joined: 16 Mar 2015, 16:53

12 May 2017, 18:31

The theme Paradise has nothing to do with the error.

I reproduce the error without any theme and I put the message in the corresponding forum.

You may delete this post.

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

14 May 2017, 17:07

Thanks for the update!

Could you please try the following codes for this issue?

Code: Select all

public void validarEmail(ComponentSystemEvent event) {
    FacesContext fc = FacesContext.getCurrentInstance();
    FacesMessage msg = new FacesMessage("Ya existe un usuario registrado con este mail");
    msg.setSeverity(FacesMessage.SEVERITY_ERROR);
    
       InputText input = (InputText) fc.getViewRoot().findComponent("formDetalle:email");
       input.setValid(false);
       fc.validationFailed();
    
    fc.addMessage("formDetalle:email", msg);
    fc.renderResponse();
}

Code: Select all

<h:form id="formDetalle" >    
    <p:tooltip position="bottom"/>
    <p:panelGrid columns="2" layout="grid" columnClasses="ui-g-12 ui-md-3,ui-g-12 ui-md-9">
            <p:outputLabel for="email" value="email"/>
             <h:panelGroup >
                   <p:inputText id="email" value="#{usuarioDetalle.usuario.email}" disabled="#{disableCampos}"/>                                              
                   <p:message for="email" display="tooltip" />                                                               
                  <f:event listener="#{usuarioDetalle.validarEmail}" type="postValidate" />           
            </h:panelGroup>  
    </p:panelGrid>                          
    <p:commandButton id="btnGuardar" value="Guardar" update="@form" actionListener="#{usuarioDetalle.guardar}" icon="fa fa-check"/>                                                                       
</h:form>
And

Code: Select all

<style type="text/css">
body .ui-outputlabel.ui-state-error {
   color: #e17576;
}
</style>

metadata
Posts: 9
Joined: 16 Mar 2015, 16:53

15 May 2017, 08:27

Thank you.

It now works correctly.

Kind Regards

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

15 May 2017, 08:32

Glad to hear, thanks for the update!

Post Reply

Return to “Paradise - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests