-
1. Re: SuggestionBox commandLink not working
krismcg Jun 23, 2008 8:34 PM (in response to krismcg)p.s. I'm using RichFaces 3.2.1 and Sun RI 1.2_08
-
2. Re: SuggestionBox commandLink not working
ilya_shaikovsky Jun 24, 2008 5:00 AM (in response to krismcg)1) do not use 1.2_08 JSF version. There is a bug with encoding which stoper for some our components.
2) in order to check your case - place rich:messages to your page. And use a4j:htmlCommandLink and a4j:form instead of h: ones. -
3. Re: SuggestionBox commandLink not working
krismcg Jun 24, 2008 11:10 AM (in response to krismcg)Thanks for the quick reply!
I switched to JSF 1.2 and the a4j:form and a4j:htmlCommandLink, and unfortunately, the actionlistener is still not called. Any other suggestions? Do you know if there is an example app with this use case?
Thanks!
-Kris -
4. Re: SuggestionBox commandLink not working
nohacks Jun 24, 2008 11:52 AM (in response to krismcg)I have had a similar issue.
Check out this messages stream.
Menu issue with IE not in FireFox
http://jboss.com/index.html?module=bb&op=viewtopic&t=137105&postdays=0&postorder=asc&start=0
or this one.
Problems with a4j:commandLink, paging forwarding and IE7
http://jboss.com/index.html?module=bb&op=viewtopic&t=137495&start=10
Both have issues with Commandlink.
Phil -
5. Re: SuggestionBox commandLink not working
krismcg Jun 24, 2008 12:08 PM (in response to krismcg)Thanks for the links! Unfortunately, the actionListener (or action property, I've tried both) are not being called when in the suggestionbox on either Firefox or IE...
-
6. Re: SuggestionBox commandLink not working
ilya_shaikovsky Jun 25, 2008 3:41 AM (in response to krismcg)krismcg, you tried using rich:messages or phasetracker in order to check lifecycle phases execution?
-
7. Re: SuggestionBox commandLink not working
krismcg Jun 25, 2008 4:24 AM (in response to krismcg)I wasn't able to retrieve any info from rich:messages, and I did not try the phasetracker. For some reason, it was not registering the command link's acitonListener. I did, however, get it to work with the following:
<script> // Variable used to disable the enter key when the user selects an item // from the suggestion box via the enter key. var enterKeyEnabled = true; function disableEnterKey() { enterKeyEnabled = false; } function enableEnterKey() { enterKeyEnabled = true; } function trapEnter(e, id) { var element = document.getElementById(id); // IE if (window.event && window.event.keyCode==13) { window.event.returnValue=false; window.event.cancel=true; element.click(); return false; } // Mozilla else if (e.charCode==13 || e.keyCode==13 || e.which==13) { // This looks hackish, but we can't click the submit button if an item // from the suggestion box was selected via the Enter Key. if(enterKeyEnabled) element.click(); disableEnterKey(); return false; } return true; } </script> <h:inputText id="searchBox" size="20" onkeypress="return trapEnter(event, '#{searchBoxBean.buttonClientId}');" value="#{searchBoxBean.currentSearchTerms}"> </h:inputText> <rich:suggestionbox id="suggestionBoxId" for="searchBox" suggestionAction="#{searchBoxBean.getSearchResults}" var="result" minChars="2" border="1" width="250" height="150" cellpadding="2" nothingLabel=""> <a4j:support event="onselect" onsubmit="disableEnterKey();" actionListener="#{searchBoxBean.selectValue}" reRender="form"><f:attribute value="#{result.contextPath}" name="contextPath"/> </a4j:support> <h:column> <h:outputText value="#{result.name}" /> </h:column> </rich:suggestionbox>
In case others were interested, I included the extra code for handling the "Enter" key.
Thanks for all the suggestions!
-Kris -
8. Re: SuggestionBox commandLink not working
krismcg Jun 25, 2008 4:28 AM (in response to krismcg)Sorry... One typo with enter key.. use this instead.
<script> // Variable used to disable the enter key when the user selects an item // from the suggestion box via the enter key. var enterKeyEnabled = true; function disableEnterKey() { enterKeyEnabled = false; } function enableEnterKey() { enterKeyEnabled = true; } function trapEnter(e, id) { var element = document.getElementById(id); // IE if (window.event && window.event.keyCode==13) { window.event.returnValue=false; window.event.cancel=true; element.click(); return false; } // Mozilla else if (e.charCode==13 || e.keyCode==13 || e.which==13) { // This looks hackish, but we can't click the submit button if an item // from the suggestion box was selected via the Enter Key. if(enterKeyEnabled) element.click(); enableEnterKey(); return false; } return true; } </script> <h:inputText id="searchBox" size="20" onkeypress="return trapEnter(event, '#{searchBoxBean.buttonClientId}');" value="#{searchBoxBean.currentSearchTerms}"> </h:inputText> <rich:suggestionbox id="suggestionBoxId" for="searchBox" suggestionAction="#{searchBoxBean.getSearchResults}" var="result" minChars="2" border="1" width="250" height="150" cellpadding="2" nothingLabel=""> <a4j:support event="onselect" onsubmit="disableEnterKey();" actionListener="#{searchBoxBean.selectValue}" reRender="form"><f:attribute value="#{result.contextPath}" name="contextPath"/> </a4j:support> <h:column> <h:outputText value="#{result.name}" /> </h:column> </rich:suggestionbox>