开发者

rich:suggestionbox submits partial string

I use jsf 1.2, richfaces 3.3.2 . For some reason my suggestionbox submits the value i typed (a.k.a suggestion string) and not what i clicked in the suggested list that opens. How do i fix this?

                    <h:panelGroup>
                        <a4j:region renderRegionOnly="false" >
                            <h:panelGrid columns="2" border="0" cellpadding="0" cellspacing="0">
                                <h:inputText value="#{ManualReportControl.street}" id="streetNames" style="width:120px;" >
                                    <a4j:support event="onchange" reRender="streetGis" ></a4j:support>
                                </h:inputText>
                                <h:graphicImage value="/images/icons/arrow.png"
                                    onclick="#{rich:component('suggestionBoxStreet')}.callSuggestion(true)开发者_StackOverflow社区"
                                    alt="" />
                            </h:panelGrid>
                            <rich:suggestionbox id="suggestionBoxStreet" for="streetNames" 
                                suggestionAction="#{ManualReportControl.autocomplete}" 
                                var="street"
                                minChars="2" >
                                <h:column>
                                    <h:outputText value="#{street}" />
                                </h:column>
                            </rich:suggestionbox>
                        </a4j:region>
                    </h:panelGroup>


Got it! I moved a4j:support from inputText to suggestionBox and now it works. The code:

                    <h:panelGroup id="streetNames">
                        <a4j:region renderRegionOnly="false" >
                            <h:panelGrid columns="3" border="0" cellpadding="0" cellspacing="0">
                                <coral:inputString value="#{ManualReportControl.street}" id="streetName" style="width:120px;" tabindexreal="13"/>
                                <h:graphicImage value="/images/icons/arrow.png"
                                    onclick="#{rich:component('suggestionBoxStreet')}.callSuggestion(true)"
                                    alt="" />
                            </h:panelGrid>
                            <rich:suggestionbox id="suggestionBoxStreet" for="streetName" 
                                suggestionAction="#{ManualReportControl.autocomplete}" 
                                var="street"
                                minChars="2" selfRendered="true" >
                                <h:column>
                                    <h:outputText value="#{street}" />
                                </h:column>
                                <a4j:support event="onselect" reRender="streetGis" ></a4j:support>
                            </rich:suggestionbox>
                        </a4j:region>
                    </h:panelGroup> 


Probably happening because onchange event is fired before the selection is made.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜