-
1. Re: suggestionBox selection (using Enter key) submits the fo
ilya_shaikovsky Jul 20, 2009 5:04 AM (in response to orik)http://livedemo.exadel.com/richfaces-demo/richfaces/suggestionBox.jsf
can't confirm neither for IE nor for FF. -
2. Re: suggestionBox selection (using Enter key) submits the fo
orik Jul 20, 2009 3:15 PM (in response to orik)This only happens when hitting enter submits the form regardless if it contains the suggestion box or not (e.g. have a command button with type="submit").
The problem is that while hitting enter on "regular" input texts submits the form is default behavior, hitting enter on a selection in the suggestion box should not submit the form.
Here is a sample code that will submit the form when hitting enter on the suggest box selection :<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%> <html> <head> <title>test</title> </head> <body> <f:view> <h:form id="testForm"> <h:inputText id="dummyInput" value="dummy" /> <h:panelGroup> <h:inputText style="margin:0px;" id="inputText" value="#{BackingBean.inputProp}" /> <h:graphicImage value="/images/arrow.png" height="14" onclick="#{rich:component('inputTextSuggestion')}.callSuggestion(true)" alt="" /> </h:panelGroup> <h:outputText id="inputTextObjects" style="font-weight:bold" /> <rich:suggestionbox height="200" width="200" usingSuggestObjects="true" onobjectchange="printObjectsSelected(#{rich:element('inputTextObjects')}, #{rich:component('inputTextSuggestion')});" suggestionAction="#{BackingBean.autocomplete}" var="item" for="inputText" fetchValue="#{item}" id="inputTextSuggestion" tokens=","> <h:column> <h:outputText value="#{item}" /> </h:column> </rich:suggestionbox> <h:commandButton value="Submit Button" type="submit" /> </h:form> </f:view> </body> </html>
-
3. Re: suggestionBox selection (using Enter key) submits the fo
ilya_shaikovsky Jul 21, 2009 6:39 AM (in response to orik)so just catch the event and use Event.stop(event) or return false;
-
4. Re: suggestionBox selection (using Enter key) submits the fo
orik Jul 21, 2009 11:01 AM (in response to orik)Tried using the onselect/oncomplete attributes on the suggestBox tag with not luck.
Can you please post a sample on how to do that ? -
5. Re: suggestionBox selection (using Enter key) submits the fo
orik Jul 21, 2009 11:12 AM (in response to orik)Please disregard previous post,
I was able to disable form submit using
onselect="Event.stop(event);" as you suggested.
Thanks for your help.