wonder if you can help me. For some reason, I am getting javascript errors for my richface components, and this has seemed to have happened without any changes to the code that was working correctly just a few days ago.
Anyway, as an example I am using a rich:componentControl as follows:
<a4j:commandButton onclick="#{rich:component('headerpopup')}.show()" id="addheader" styleClass="saveState" value="Add Column Header">
<rich:componentControl for="headerpopup" attachTo="addheader" operation="show" event="onclick"/>
</a4j:commandButton>
And the javascript error I get is:
Uncaught TypeError: Cannot call method 'show' of undefined
I'm suspecting I am missing a javascript file that Richfaces should be providing, is this correct?
I'm using Richfaces 3.3.1 on Jboss 5.1.0 and Seam 2.2.2.
Any help would be helpful.
oops....
It was a schoolboy error:
I had removed the jQuery noConflict line, not knowing what it was...
<script>var $e = esiQuery.noConflict();</script>
Related
you have saved me many times ago with this forum, but now I am really stuck and don't now where to search any longer...
I always get the following error message (warning level, but method is also not executed correctly):
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'editor' resolved to null: javax.faces.FacesException: #{cc.attrs.selectionListener}
I have isolated the problem to a few lines of code:
This is my main file:
<c:forEach items="#{myBean.getEditors()}" var="currentEditor" >
<ui:include src="#{currentEditor.getPanel()} >
<ui:param name="editor" value="#{currentEditor} />
</ui:include>
</c:forEach>
The bean.getEditors() (session scoped) just returns a list with one single entry at the moment. The 'editor' is a POJO with some simple attributes and two listener methods. The listener method does only write a log entry. (Should of course do more in future)
The file which is included looks like this:
<h:selectOneMenu value="#{editor.menuValue}>
<f:selectItem itemValue="Value 1" />
<f:selectItem itemValue="Value 2" />
<a4j:ajax event="change" listener="#{editor.menutListener()}" />
</h:selectOneMenu>
<myComponent:treeComponent id="tree" selectionListener="#{editor.treeListener()} />
The component I created consists of a richfaces tree and when clicking on a node the following method is called:
<a4j:jsFunction name="performSelection" action="#{cc.attrs.selectionListener} />
I am quite confident that the composition itself is ok because I use it also at different places. When I remove the action from the a4j:jsFunction it also works perfect.
For me it smells a bit like the bug JSF 1223
The workaround does not work for me - probably because I create the param in the forEach.
I had similar problems (ui:param + component) before, but was able to solve them with giving the full path as attribute instead of a parameter. But this does not work here because it is used in too many different places.
Please help, I cannot be the only one with this problem, but I simply do not find any other threads for this.
Edit:
Today with a fresh mind I came even closer to the problem. You can forget the whole include/ forEach stuff...
<myComponent:treeComponent id="tree" selectionListener="#{myBean.getSingleEditor().treeListener()} />
Does work, while
<ui:param name="editor" value="#{myBean.getSingleEditor()} />
<myComponent:treeComponent id="tree" selectionListener="#{editor.treeListener()} />
does not work.
Well the JAVA code is performed, but the error is written to the log and the render and oncomplete method of the jsFunction do not work.
I also tried to use "data" instead of "action" for testing. No error is written to log, but JAVA method is not even called.
After many days of try&error I found a solution that is working for me:
I splitted up the listener method to one parameter with the JAVA class and one parameter with the the method name (as simple String)
The action method now looks like:
<a4j:jsFunction name="performSelection" action="#{cc.attrs.listenerClass[cc.attrs.listenerMethodName]}" />
Not nice but working... Perhaps it helps someone - or anybody can explain more...
By the way, the following was not working for me:
<a4j:jsFunction name="performSelection" action="#{cc.attrs.listenerClass[staticMethodName]}" />
While this was ok...
<a4j:jsFunction name="performSelection" action="#{cc.attrs.listenerClass.staticMethodName()}" />
Don't know - perhaps my head is running agains the same wall again and again...
My code in RichFaces 3.3.3:
<a:region>
<h:form>
<a:poll id="feed" enabled="true" reRender="feedReader" interval="100"/>
</h:form>
</a:region>
<h:form>
<h:outputText value="#{feedReader2.title}" id="feedReader" />
</h:form>
This is close to the example here: http://www.mastertheboss.com/richfaces/using-ajax-with-jboss-richfaces
What it should do is poll the server which reads an rss feed and gives back the title.
However, this is not working. In Chrome developer tools I can't see any AJAX requests made to the server. Instead, I see an error Uncaught TypeError: Cannot read property action of null on framework.pack.js. The line in which the error occurs is:
this._actionUrl=(this._form.action)?this._form.action:this._form
I can only guess that this is releated to the <h:form> which doesn't have an action attribute. But I don't see why I need this here, as it is not included in all of the examples you can find.
Moreover, I do not want the <h:outputText> to query the bean on page load. My aim is to use AJAX to read the feed after the page is done rendering.
If this is an issue related to my RichFaces version, could someone please give me an example on how to do this in 3.3.3?
I found the issue. It was an error outside the above markup i've included. Had two <h:form> nested, which caused the second one to malfunction.
in my JSF 2.2 application I was trying to create an AJAX request using RichFaces 4.3.2 with .
The rendered HTML is:
<a href="#" id="x" name="x" onclick="RichFaces.ajax(x;,event,{x:x} );return false;">
The problem is that after clicking the link, nothing happens and an error in my Chrome Console appears:
Uncaught TypeError: Object #<Object> has no method 'ajax'
When I type RichFaces into console I get some autocomplete possibilities like `Event, valueOf' etc. but it doesn't see any specific RichFaces functions.
It looks like the RichFaces library wouldn't be attached at all but I have no idea why.
Why is it happening?
The code of the commandLink:
<ui:repeat value="#{commonsOperations.newsList}" var="n">
<li>
<a4j:commandLink action="#{commonsOperations.setSelectedNews(n)}"
value="#{n.title}" render="content" />
</li>
</ui:repeat>
I found out the problem why RichFaces libraries were not loaded properly was the conflict between RichFaces and PrimeFaces. After removing PrimeFaces from POM, all RichFaces javascript files are loaded.
I have some required fields.
When I try to submit the page with h:commandLink I get the required message (As defined by me).
When I use a4j:commandLink to call a method, I don't get the message (Although the method is not called, which proves to me that the required-validation does work)
Doesn't Work:
<a4j:commandLink value="#{msg.Submit_Button}" styleClass="linkStyle" action="#{general.submit}"
reRender="StatusPanelStatusText, SendingSMSMSG" />
Works (But no ajax, no good):
<h:commandLink value="#{msg.Submit_Button}" styleClass="linkStyle" action="#{general.submit}" />
What Gives?
Thanks!
UPDATE
Versions - JSF 1.2.7 with Richfaces 3.3.2 SR1
just trying to integrate this commandLink
<a4j:commandLink reRender="results-view" actionListener="#{myaction}" oncomplete="return false;" value="#{msg1.advanced_search}">
<a4j:support event="onclick">
<f:setPropertyActionListener value="./page.xhtml" target="#{changeViews['new-view'].value}" />
</a4j:support>
</a4j:commandLink>
On an applicacion which is using JSF2. If I leave it, I get this error
Tag Library supports
namespace: http://richfaces.org/a4j,
but no tag was defined for name:
support
I was trying to find something on the net, but I couldn't figure out. Some help would be great.
Thanks in advance
The a4j:support has been replaced by a4j:ajax since RichFaces 4.x.
You seem to be reading RichFaces 3.x documentation or just have upgraded RichFaces 3.x to 4.x. This is a pretty major step where a lot of things are been changed. Read the migration guide (in this particular case, it's described in a4j components) and also read the new RF4 component reference.