Object selecteded event in autoComplete?

UI Components for JSF
Post Reply
jaizen
Posts: 9
Joined: 29 Dec 2010, 01:04

21 Feb 2011, 19:53

Hi

I am trying to perform some client side action when an object is selected from the autoComplete drop down selection. I am struggling to find the right client side event for this. onselect, onchange, oncomplete events do not know whether an object was selected or not especially when there are no results returned. Richfaces has an event called 'onobjectchange' on their suggestionBox component which did the job. Is there something similar that I can use in p:autoComplete?

Also, is there a way to show a default label such as 'No results found' when there are, well, no results returned? I feel that it will confuse users when they dont see any results esp. when used in conjuction with forceSelection=true.

Please help. I need find a solution for this as soon as possible.
Thanks

Jaizen

Glassfish 3.1.2 | Mojarra 2.1.6 | Primefaces 3.5

poppy
Posts: 18
Joined: 26 Nov 2010, 20:27
Location: Spain

21 Feb 2011, 20:09

Hi, i think you need the selectListener and onSelectUpdated options
Here is an example:

Code: Select all

<p:autoComplete id="productMessage" value="#{goBean.selectItem}" 
	 completeMethod="#{autoCompleteBean.valueChanged}"
	 var="selectItem" 
	 itemLabel="#{selectItem.label}" 
	 itemValue="#{selectItem}" 	
	 minQueryLength="4"
	 maxResults="5"
	 forceSelection="true"
	 converter="productConverter"
	 selectListener="#{goBean.actionButton}"
	 onSelectUpdate="body myProductDetail"
	 style="width:400px;"
	 />
Good luck!!
Eclipse Helios.
JSF 2.0 Mojarra 2.0.2 (FCS b10)
Primefaces-2.2.1
jboss-6.0.0.-M4
EJB3.0/JPA
Hibernate
Mysql 5.1

jaizen
Posts: 9
Joined: 29 Dec 2010, 01:04

24 Feb 2011, 03:28

poppy,
thanks for replying. But I think the option you have mentioned is for ajax updates/rendering. I still wont know whether or not I selected an item from the list. I may have to try callback parameters and see if that will help me.
Thanks

Jaizen

Glassfish 3.1.2 | Mojarra 2.1.6 | Primefaces 3.5

little_b
Posts: 7
Joined: 18 Dec 2010, 20:58

28 Feb 2011, 20:57

i want to vote about this question. I'm looking for a solution too

Urbiwanus
Posts: 27
Joined: 25 Apr 2011, 10:36

26 Apr 2011, 08:49

Any solutions for this problem yet ?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests