This content has been marked as final.
Show 6 replies
-
1. Re: Bug with suggestionBox in Opera 9.2x
eunnini Mar 23, 2009 8:12 AM (in response to manoz82)I have the same problem that has definitely not solved even in 9.64, check this - it simply does not work in Opera!
<h:form> <h:panelGroup id="wrappedPanel"> <h:inputText id="name" value="#{userSession.selectInput}"/> <rich:suggestionbox popupClass="sugPopup" for="name" suggestionAction="#{userSession.autocompleteNames}" var="result" minChars="3" shadowOpacity="4" border="1" width="250" height="250" shadowDepth="4" selectedClass="sugSelection" usingSuggestObjects="true"> <a4j:support event="onselect" actionListener="#{userSession.suggestSelected}"/> <h:column> <h:outputText value="#{result}" /> </h:column> </rich:suggestionbox> </h:panelGroup> <h:panelGrid columns="1" id="table"> <h:commandButton action="#{userSession.test}" value="Submit" /> </h:panelGrid> </h:form>
-
3. Re: Bug with suggestionBox in Opera 9.2x
manoz Mar 23, 2009 10:09 AM (in response to manoz82)It's been a while since I reported this problem. In the mean time I found some sort of a workaround, it's not exactly a solution, but a pretty messy javascript fix. If anyone's interested I could post it here, but I couldn't recommend it for production environments.
-
4. Re: Bug with suggestionBox in Opera 9.2x
eunnini Mar 23, 2009 10:37 AM (in response to manoz82)pleazzzzz, post it manoz!
I'd appreciate this so much!" -
5. Re: Bug with suggestionBox in Opera 9.2x
manoz Mar 24, 2009 10:20 AM (in response to manoz82)Ok, you've been warned :)
So, in opera, when you click a button the form doesn't get submitted;
To override this add onclick behavior to the submit button:<h:commandButton id="button1" value="OK" action="..." onclick="this.form.submit()" />
... but there is a problem.
The form get's submitted and you have a post request but without the information of which button is clicked.
To override this you have to manually add an input which name and value pair is equal to that of a submit button.
So a complete solution is:<h:commandButton id="button1" value="OK" action="..." onclick="richFacesOperaHack(this.form, 'button1', 'OK')" />
and that javascipt function is:... function richFacesOperaHack(form, commitButtonID, commitButtonValue) { if (BrowserDetect.browser == "Opera") { var node = document.getElementById("javax.faces.ViewState").cloneNode(false); node.name = commitButtonID; node.id = "randomlyGeneratedId" node.value = commitButtonValue; form.appendChild(node); form.submit(); } return true; } ...
I clone the hidden input that jsf always generates instead of creating a completely new element.
BrowserDetect is a free javascript that I got from www.quirksmode.org
...
Try it and give me some feedback on how it works for you. -
6. Re: Bug with suggestionBox in Opera 9.2x
eunnini Mar 25, 2009 8:20 AM (in response to manoz82)Thank you so much - it really works!