Using Global limited tooltip and Shared tooltip

Community Driven Extensions Project
Post Reply
User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

28 Mar 2012, 19:44

Hi,

We want to use global limited tooltips for the replacement of P:messages.And when we are going to apply p:messages in one panel we can see the same messages in other panels which not required.But we had problem with using global limited tooltip and mostly "ForSelector" attribute is not proper. I tried same like showcase example and we had same problem with Shared Tooltip for filters.Any insight would be appreciated.

Environment:
Primefaces 3.2
Primefaces extension 0.4.0
JSF2.0
WAS 6.1
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

28 Mar 2012, 20:24

Hi,

What is your code? Can you post it here? I haven't understood how you plan to intergrate p:messages inside of pe:tooltip. See this blog post how to show error messages inside of pe:tooltip in a generic way http://ovaraksin.blogspot.de/2012/03/sh ... -with.html
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

29 Mar 2012, 16:05

Hi Oleg,

Thank you for your response.

We started doing validations in our new PF application And we had options like using P:messeges or global limited tooltip.
1.When we are going to use P:messages validations going to apply all the panels.
2. Global limited tooltips are not working

Example validations required: FirstName cannot be empty,maximum and mininum length of account number.......
we are using templates in all pages.is it the reason for problems? And we want to use shared tooltips for filters also but same problem like Global limited tooltip

Now we are trying like this

XHTML

Code: Select all

<p:inputText id="lastName" required="true" label="Last Name" title="#{component.valid ? '' : myController.messageForLastName}"/>

        
Java (controller bean)

Code: Select all

              public String getMessageForLastName() {
                return FacesContext.getCurrentInstance().getMessages("lastName").next().getDetail();
                }
      
The following code working only if we include P:messegs in our page

Search Panel Code in my application

Code: Select all

           	<ui:define name="SearchPanel">

                <p:messages id="messages" autoUpdate="true"/>
  
	<p:panel styleClass="myPanelStyle myPanelStyleTitle" collapsed="true"
			id="pnl" header="Search Accounts" toggleable="true" 
			toggleSpeed="500" closeSpeed="2000" widgetVar="panel">
				
		<f:facet name="header">
		<h:outputText value="SEARCH" style="margin-left:1%;" /></f:facet>
		<p:spacer width="0" height="8"></p:spacer>
		<div style="margin-right: auto; margin-left: auto;">
				<p:panelGrid columns="6" cellspacing="3">
				<h:outputText value="Investor Name" style="font-weight:bold;" />
			<h:panelGroup>
				<p:inputText id="investorname"value="#{accounts.searchDet.invName}" label="investorname" >
				</p:inputText>
				<pe:keyFilter for="investorname" regEx="/[a-zA-z0-9\@\']/i"/>
				<p:watermark for="investorname" value="Enter Value To Search" />
				<!--  <p:message for="investorname" />-->
				</h:panelGroup>
				<h:outputText value="Account Number" style="font-weight:bold;" /> 
			<h:panelGroup>
	<p:inputText id="accountnumber"  label="Account Number" maxlength = "9" value="#     {accounts.searchDet.accountnumber}" required="true" 
                  title="#{component.valid ? '' : 'Account number cannot be empty'}">
                  <f:validateLength minimum="2" maximum="9"/>
	 </p:inputText>
				<pe:keyFilter for="accountnumber" mask="pint"/>
				<p:watermark for="accountnumber" value="Enter Value To Search" /> 
			</h:panelGroup>
				<h:outputText value="Dealer Code *" style="font-weight:bold;" />
			<h:panelGroup>
		<p:inputText id="delcode" value="#{accounts.searchDet.dealerCode}" label="Delcode" disabled = "#{accounts.dealerDisabled}"      required="true" title="#{component.valid ? '' : accounts.messageForDealerCode}">
		<f:validateLength  maximum="4"/>
		</p:inputText>
		                                <pe:keyFilter for="delcode" mask="alphanum"/>
				<p:watermark for="delcode" value="Enter Value To Search" />
						
			</h:panelGroup>
				<h:outputText value="Representative Code" style="font-weight:bold;" />
			<h:panelGroup>
	<p:inputText id="repCode" rendered = "#{accounts.repCodeRendered}"
	value="#{accounts.searchDet.repCode}" label="RepCode" disabled = "#{accounts.repDisabled}" required="true" title="#{component.valid ? '' : accounts.messageForRepCode}">
				<f:validateLength maximum="6"/>
	</p:inputText>
				<p:watermark for="repCode" value="Enter Value To Search" />
	<p:autoComplete id="dd" dropdown="true" maxlength = "4" disabled = "#{accounts.repDisabled}" rendered = "#{accounts.repCodeDDRendered}"
						 value="#{accounts.searchDet.repCode}"  queryDelay = "300" forceSelection = "true" autocomplete = "off" scrollHeight="200"completeMethod="#{accounts.complete}" />
                   
                    <p:watermark for="dd" value="Enter Value To Search" />
					</h:panelGroup>
						
						<h:outputText value="SIN" style="font-weight:bold;" />
						<h:panelGroup>
						<p:inputText id="sin"
							value="#{accounts.searchDet.sin}" label="Sin"  maxlength = "11"   required="true" title="#{component.valid ? '' : accounts.messageForSin}">
							<f:validateLength  min="1" maximum="11"/>
								</p:inputText>
								<pe:keyFilter for="sin" mask="num"/>
								<p:watermark for="sin" value="Enter Value To Search" />
					</h:panelGroup>
						<h:outputText value="Dealer Account Number" style="font-weight:bold;" />		
					</p:panelGrid>
	<!--  <pe:tooltip global="true" position="left center" targetPosition="right center"/>  -->
	<p:commandButton value="Search" update=":form:tbl,:form:chartpanel,:form:Detail,:form:user," process = "@form"
	actionListener="#{accounts.searchAccount}" onclick="PrimeFaces.cleanWatermarks();" oncomplete="PrimeFaces.showWatermarks(); "/>
                <!--<pe:tooltip global="true" position="left center" targetPosition="right center"  forSelector=".ui-state-error"/>           		   
	--></div>
			</p:panel>
			
	</ui:define>
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

29 Mar 2012, 16:29

The following code working only if we include P:messegs in our page
Strange. Do you mean messages in tooltips only work when p:messages is available?

By the way, you don't need to update global pe:tooltip. It's not a problem, but place it outside of updateable area.

And you can use pe:keyFilter as child component

Code: Select all

<p:inputText id="investorname"value="#{accounts.searchDet.invName}" label="investorname" >
    <pe:keyFilter regEx="/[a-zA-z0-9\@\']/i"/>
</p:inputText>
Provide me a very very simple code please where shared / limited global tooltips are not working. I don't think it's by reason of templates. We also have templates and it always works.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests