[richfaces-issues] [JBoss JIRA] Commented: (RF-7527) h:inputText that has rich:suggestionBox practically cannot be combined with a4j:support event="onBlur" because of 2 annoying problems

Ilya Shaikovsky (JIRA) jira-events at lists.jboss.org
Tue Jul 21 10:40:29 EDT 2009


    [ https://jira.jboss.org/jira/browse/RF-7527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12477014#action_12477014 ] 

Ilya Shaikovsky commented on RF-7527:
-------------------------------------

video not available.
Answering last post  started with "Here is the scenario with queue and rendering of parent component (if my attachment does not speak for itself)"

I've made all the steps you describe and my opinion not changed. All works just like you designed.

my code:

	<h:form id="form">
		<a4j:queue />
		<a4j:outputPanel id="XXXXX">
		<h:panelGrid columns="2">
			<h:outputText value="Input with states names suggestions" />
			<h:panelGrid columns="2" border="0" cellpadding="0" cellspacing="0">
				<h:inputText style="margin:0px;" id="statesinput" value="#{userBean.name}">
					<a4j:support event="onblur" reRender="XXXXX" bypassUpdates="true" ajaxSingle="true"/>
				</h:inputText>
				<h:graphicImage value="/images/icons/arrow.png"
					onclick="#{rich:component('suggestion')}.callSuggestion(true)"
					alt="" />
			</h:panelGrid>
		</h:panelGrid>
		<rich:suggestionbox height="200" width="200"
			suggestionAction="#{capitalsBean.autocomplete}" var="cap"
			for="statesinput" fetchValue="#{cap.name}" id="suggestion" tokens=",">
			<h:column>
				<h:graphicImage value="#{cap.stateFlag}" />
			</h:column>
			<h:column>
				<h:outputText value="#{cap.name}" />
			</h:column>
		</rich:suggestionbox>
		</a4j:outputPanel>
	</h:form>

1) off-top pay attention that a4j:queue not used around the content but just as I defined.
2) 5A - works like designed. As I told you blur fired BEFORE selection. So OLD input value(empty) goes to server side before new selection applied. And after re-Render it's empty as it should. According to the policy we not want to continue discussion of not confirmed issues here because the solution will be visible only for you. Start please new "How To" forum thread and we will do our best to propose correct solution which could be found by the community. Thanks for your patience.
3) 5B this also caused by the same support. Lets I describe it step by step. First click causes callSuggestion to be called. So suggestion opens. And  in the same moment script put focus in your input. So the second click on the arrow causes support for onblur to be called and reRender the input with suggestion so it's closed. And subsequent clicks causes ajax request for suggestion getting prepared in the moment when destruction of old input and suggestion object occurs :) So when response comes - no element to attach it.

Awaiting for your forum thread. 

> h:inputText that has rich:suggestionBox practically cannot be combined with a4j:support event="onBlur" because of 2 annoying problems
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: RF-7527
>                 URL: https://jira.jboss.org/jira/browse/RF-7527
>             Project: RichFaces
>          Issue Type: Bug
>          Components: component-input
>    Affects Versions: 3.3.1
>         Environment: The scenario is for Firefox 3.5 and Opera 9.1, RichFaces >= 3.1
>            Reporter: Konstantin Spirov
>            Assignee: Ilya Shaikovsky
>         Attachments: test.xhtml
>
>
> There are 2 problems mentioned here, but I am combining them in one report, because  the test scenario I will provide is the same. The workarounds I am providing are not satisfying.
> The two these problems are in construction like:
> <h:inputText style="margin:0px;" id="xxx" value="xxx">
>                     <a4j:support event="onblur" reRender="xxx" bypassUpdates="true" ajaxSingle="true"/>
> </h:inputText>
> <rich:suggestionbox for="xxx">
> The approach is a4j:support rerender=xxx is *very standard* (see seam-gen for examples), and it is practically necessary if we want to modify automatically from the server the field after it is changed.
> Problem 1: Display suggestion list and click on some suggestion (with the mouse). The value will be updated for a while, then *the old content* is recovered (incorrectly ). We have again empty field, which is very annoying. PLEASE notice that if you had used arrows and tab from the keyboard, everything would work correctly - so there is a solution, but it doesn't work when the user clicks with the mouse (our users usually click with the mouse, don't use keyboard  :-) 
> Problem 2: JavaScript error if you try to display the suggestion again (see your browser console).  The suggestionbox stops working until you reload the page.
> Exact steps to reproduce quickly test platform (I am sending  an attachment just for refference - it is similar)
> 1) Take from Richfaces showcase RichInput:SuggestionBox:ObjectsUsageExample
> 2) Add value="#{bean.attribute} to <h:inputText (create the "bean" in the most quick and easy for you way, in my platform it is seam component in conversation scope)
> 3) Inside  <h:form> wrap with <a4j:queue> (probably not necessary, but let's not risk the repeatability of the scenario)
> 4) From rich:suggestionBox remove:
>             usingSuggestObjects=...
>             onobjectchange=...
> 5) Add in h:inputText <a4j:support event="onblur" reRender="statesinput" bypassUpdates="true" ajaxSingle="true"/>
> You will see that the last step line makes everything unusable :-(

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list