-
1. Re: RichFaces 3.1.5 with Tiles 2.x
ilya_shaikovsky Jul 17, 2008 4:19 AM (in response to bjm88)show the code which you using ofr suggestion please.
-
2. Re: RichFaces 3.1.5 with Tiles 2.x
bjm88 Jul 17, 2008 8:27 AM (in response to bjm88)There is a lot of code in different places, but here is what I think is relevant
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:view>
<h:form id="payeeBoBForm">
<h:panelGroup style="display: block;">
<h:panelGrid columns="2">
<h:panelGroup>
<h:inputText styleClass="inputText" id="producerName"
value="#{payeeBookOfBusinessMB.producerName}" maxlength="60">
</h:inputText>
<rich:suggestionbox for="producerName" ajaxSingle="true"
suggestionAction="#{payeeBookOfBusinessMB.getProducerNameList}" width="200"
height="100" var="possibleNames"
nothingLabel="No matching name" fetchValue="#{possibleNames}" minChars="2">
<h:column>
<h:outputText value="#{possibleNames}" />
</h:column>
</rich:suggestionbox>
</h:panelGroup>
</h:panelGrid>
</h:form>
</f:view>
The java backing bean method is this:
public List getProducerNameList(Object event){
String partialStr= event.toString().toLowerCase();
ProducerDelegate producerDelegate = new ProducerDelegate();
List producerNameList = null;
producerNameList = producerDelegate.getProducerNameList(partialStr);
return producerNameList;
}
This is pretty much straight from the user_doc.pdf. I have the RichFaces jars in my WEB-INF/lib and the filter servlet config in my web.xml. The suggestion box is actually working, kind of. My problem is my method returns a list, and I think under the covers RichFaces is then returning null, which wont work with JSF and Tiles (that I know of). Let me know if you need more code, thanks. -
3. Re: RichFaces 3.1.5 with Tiles 2.x
bjm88 Jul 17, 2008 8:53 AM (in response to bjm88)Ok reading the doc I though the attribute "selfRendered=true" may help, so I put that in, changing the code to this:
<rich:suggestionbox for="producerName" ajaxSingle="true"
selfRendered="true"
suggestionAction="#{payeeBookOfBusinessMB.getProducerNameList}" width="200"
height="100" var="possibleNames"
nothingLabel="No matching name" fetchValue="#{possibleNames.producerName}" minChars="2">
<h:column>
<h:outputText value="#{possibleNames.producerName}" />
</h:column>
</rich:suggestionbox>
Now it is working on Firefox! but not on IE 6 ( we have IE 6.0.29 on XP SP2). I really need this to work on IE, just using FireFox for testing, and of course with IE I dont know the javascript error, just says error at bottom. Any ideas? -
4. Re: RichFaces 3.1.5 with Tiles 2.x
bjm88 Jul 17, 2008 1:22 PM (in response to bjm88)Ok I turned on script debugging in IE, and got this, seems RichFaces is using some method calls IE doesn't support for DOM objects...??
Object or element doesn't exist
return elements;};return function(className,parentElement){return $(parentElement||document.body).getElementsByClassName(className);};}(Element.Methods);Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(element){this.element=$(element);},_each:function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(iterator);},set:function(className){this.element.className=className;},add:function(classNameToAdd){if(this.include(classNameToAdd))return;this.set($A(this).concat(classNameToAdd).join(' '));},remove:function(classNameToRemove){if(!this.include(classNameToRemove))return;this.set($A(this).without(classNameToRemove).join(' '));},toString:function(){return $A(this).join(' ');}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();if(!window.RichFaces){window.RichFaces={};}
'getElementsByClassName(..).0;' is null or not an object
this.stopIndicator();var scroll=document.getElementsByClassName("_suggestion_size_",this.update)[0]||this.update;scroll.scrollTop=-1;scroll.scrollLeft=-1;this.index=0;this.prevIndex=-1;var nothingLabel=$(this.update.id+"NothingLabel");if(nothingLabel&&this.hasFocus&&!this.wasBlur){if(this.entryCount<1){Element.show(nothingLabel);Event.observe(nothingLabel,"click",this.onNothingLabelClick);Event.observe(this.element,"blur",this.onNothingLabelClick);this.show();}}
I still have no idea how to fix this, or what RichFaces components/attributes I should avoid in doing this. Has anyone successfully setup a suggestion box in IE with JSF and Tiles?