2016-04-29 14 views
3
angezeigt wird

I Fehlermeldung als Tooltip wie in diesem Beispiel angezeigt werden soll: http://www.primefaces.org/showcase/ui/message/messages.xhtmlPrime faces - Nachricht Tooltip nicht

Hier ist mein JSF Code-Schnipsel:

<h:form id="loginForm"> 
    <p:messages id="messages" showDetail="true" closable="true" for="login"/> 
    <h:panelGrid columns="3" cellpadding="3" width="100%"> 
     <p:outputLabel for="username" value="Login: "/> 
     <p:inputText style="width: 100%;" value="#{loginBean.username}" required="true" id="username"/> 
     <p:message for="username" display="tooltip"/> 

     <p:outputLabel for="password" value="Password:"/> 
     <p:password style="width: 100%;" value="#{loginBean.password}" required="true" id="password"/> 
     <p:message for="password" display="tooltip"/> 
    </h:panelGrid> 
    <p:commandButton value="OK" action="#{loginBean.login()}" update="loginForm" style="float: right; margin-top: 5px;"/> 
</h:form> 

Hier ist die HTML-Ausgabe-Schnipsel für Login-Reihe:

<tr> 
<td><label id="loginForm:j_idt9" class="ui-outputlabel ui-widget ui-state-error" for="loginForm:username">Login: <span class="ui-outputlabel-rfi">*</span></label></td> 
<td><input id="loginForm:username" name="loginForm:username" type="text" value="" style="width: 100%;" aria-required="true" class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all ui-state-error" role="textbox" aria-disabled="false" aria-readonly="false"></td> 
<td><div id="loginForm:j_idt10" aria-live="polite" class="ui-message ui-helper-hidden ui-message-error ui-widget ui-corner-all"><span class="ui-message-error-icon"></span><span class="ui-message-error-detail">Login: Validation Error: Value is required.</span></div></td> 
</tr> 

Es eindeutig HTML-Code für den Tooltip ist & Eingänge die rote Umrandung, aber Tooltip Nachricht wird nicht nur zeigen, wenn ich hove r über das Eingabefeld. Mein Formular befindet sich im Dialogfenster.

Primefaces 6.0.RC2

Antwort

5

Sie dieses Snippet innerhalb <h:body>...</h:body> Paar-Tags gesetzt und außerhalb <h:form> ... </h:form> Paar tags:

<p:tooltip /> 


Dies ist Quellcode nur (Leiharbeit, der Einfachheit halber, ich verwenden Sie keine Bohne mit seinen Eigenschaften, Methoden):

<?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:h="http://xmlns.jcp.org/jsf/html" 
     xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 
     xmlns:f="http://xmlns.jcp.org/jsf/core" 
     xmlns:p="http://primefaces.org/ui"> 

    <h:head>   
    </h:head> 

    <h:body> 

     <p:tooltip /> 

     <h:form id="loginForm"> 
      <p:messages id="messages" showDetail="true" closable="true" for="login"/> 
      <h:panelGrid columns="3" cellpadding="3" width="100%"> 
       <p:outputLabel for="username" value="Login: "/> 
       <p:inputText style="width: 100%;" required="true" id="username"/> 
       <p:message for="username" display="tooltip"/> 

       <p:outputLabel for="password" value="Password:"/> 
       <p:password style="width: 100%;" required="true" id="password"/> 
       <p:message for="password" display="tooltip"/> 
      </h:panelGrid> 
      <p:commandButton value="OK" update="loginForm" style="float: right; margin-top: 5px;"/> 
     </h:form> 
    </h:body> 

</html> 


Das ist mein Screenshot: 012.
enter image description here

+1

Ja, das hat den Trick gemacht. Sie sollten das in der Vitrine besser erklären. Die Art wie es aussieht ist ein Teil des ersten Beispiels. TY. –