-
1. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
rhare2 May 24, 2013 10:48 AM (in response to rhare2)I went ahead and created a bug report in JIRA RF-13018.
-
2. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
lfryc May 24, 2013 12:28 PM (in response to rhare2)Hey Rob,
could you post details of a request headers and a response text (XML with <partial-response>) as observed in Chrome Dev Tools / Firebug or any other Network inspecting tool?
Note: as issue report states, this affects 4.2.3 and 4.3.2 as well
-
3. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
rhare2 May 24, 2013 1:01 PM (in response to lfryc)Lukáš Fryč wrote:
Hey Rob,
could you post details of a request headers and a response text (XML with <partial-response>) as observed in Chrome Dev Tools / Firebug or any other Network inspecting tool?
From Chrome Dev Tools.
Request Headers:
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:462
Content-type:application/x-www-form-urlencoded;charset=UTF-8
Cookie:JSESSIONID=UTjNTjzDiLc-X5pTXK1E3AUm.undefined
Faces-Request:partial/ajax
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/button/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36Form Data:
testForm:testForm
testForm:button1:Button 1
testForm:button2:Button 2
javax.faces.ViewState:5007719877964413075:2892067377465562569
javax.faces.source:testForm:button1
javax.faces.partial.event:click
javax.faces.partial.execute:testForm:button1 @component
javax.faces.partial.render:@component
org.richfaces.ajax.component:testForm:button1
testForm:button1:testForm:button1
rfExt:null
AJAX:EVENTS_COUNT:1
javax.faces.partial.ajax:true
Response Headersview sourceResponse:
<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[5007719877964413075:2892067377465562569]]></update></changes></partial-response>
Note: as issue report states, this affects 4.2.3 and 4.3.2 as well
Yep, I tried it under both to make sure it wasn't fixed in a newer release than what I was using at the time I ran into this issue.
If you need anything else just let me know.
-
4. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
rhare2 May 24, 2013 1:17 PM (in response to rhare2)A little more background:
I came across this when I had a a4j:commandButton on the same page as a a4j:jsFunction. For some reason the a4j:jsFunction stopped working and once I dug into it I discovered that I was seeing the a4j:commandButton action fired instead of that on the a4j:jsFunction. I started trying to make a much simpler case than what I had in my code, which is when I got down to the example above. In my case because the a4j:commandButton was marked immediate, only it was fired and not all the actions. If you change one of the buttons to type=submit, the problem goes away. Likewise intermediate will also change the behavior, you might only get the wrong action fired as opposed to all of them.
My original application code broke on Chrome 27, not Chrome 26. It looks like Chrome 27 passed all the buttons in the form data, and it didn't in Chrome 26. Not sure if this is part of the problem but it's what led me to the simple case.
-
5. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
lfryc May 24, 2013 1:59 PM (in response to rhare2)I know you are using JBoss AS 7.1.1.Final / EAP 6.1.0.Beta1 - by any chance, aren't you using non-default versions of Mojarra?
Or rather: what versions of Mojarra your app run with?
-
6. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
lfryc May 24, 2013 2:03 PM (in response to rhare2)ah, so your issue can be reproduced only on Chrome 27? could you eventually try other browsers?
-
7. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
rhare2 May 24, 2013 3:55 PM (in response to lfryc)Lukáš Fryč wrote:
I know you are using JBoss AS 7.1.1.Final / EAP 6.1.0.Beta1 - by any chance, aren't you using non-default versions of Mojarra?
Or rather: what versions of Mojarra your app run with?
Just out of the box Jboss AS 7.1.1.Final and EAP 6.1.0.Beta1 which means Mojarra 2.1.7-jbossorg-1 and Mojarra 2.1.19-jboss
org-1 respectively.Lukáš Fryč wrote:
ah, so your issue can be reproduced only on Chrome 27? could you eventually try other browsers?
No, the problem is on many browsers. Sorry, I I wasn't very clear in my last post. What I was trying to say is that something changed in Chrome 27 that brought the problem to light in what appears to be including all the buttons in the form data. However, it was just an exacerbating condition. Once I started trying to make a simple example (the one in the original post), it occurs on all the following broswers:
- Fedora 17, Chrome 27.0.1453.93
- Fedora 17, Firefox 20.0
- Fedora 16, Firefox 18.0.2
- Fedora 16, Chrome 26.0.14.10.63
- Windows 7, Chrome 26.0.1410.64 m
- Windows 7, IE 9.0.8112.16421
- Windows 7, Firefox 20.0.1
- Android 4.2.2. Chrome 18.0.1025469
Are you able to duplicate the issue? I'm assuming that having both actions fire is not the expected behavior?
I put exactly how using Eclipse I created the application in the JIRA entry.
-
8. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
lfryc May 28, 2013 6:44 AM (in response to rhare2)Rob, could you confirm in the JIRA that when you remove @type, then the issue disappears?
-
9. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
rhare2 May 28, 2013 7:57 PM (in response to lfryc)Lukáš Fryč wrote:
Rob, could you confirm in the JIRA that when you remove @type, then the issue disappears?
I did confirm that if the buttons are of type="submit" then it does not occur and added a comment to JIRA.
However, that is not an easy workaround because on a form with text fields, hitting return will cause the first button labeled "submit" to be activated. Hence the reason you want type="button" on all buttons except 1 which is type=submit. If you change all to type="submit" then hitting return within a text field will cause the first button on the page to be activated, possibly not what was intended. The work around will require playing games with either CSS or javascript to cause the right button to appear first on the page to fix a new problem caused by the workaround. UGH!
-
10. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
bleathem May 29, 2013 10:00 PM (in response to rhare2)If you want to experiment a bit, you can try the commandButton from the RichFaces bootstrap sandbox project. It has explicit support for type=button:
https://bootstrap-richfaces.rhcloud.com/component/commandButton/index.jsf
This is likely how we will move forward with the commandButton in RF 5, it would be good to get some feedback if it resolves your problem.
Brian
-
11. Re: a4j:commandButton - pressing button fires all a4j:commandButton actions on the page
klhoste2 Dec 1, 2014 11:39 AM (in response to rhare2)Hello,
Does this bug affect the 4.3.7 version ?
I'm having a similar issue using h:commandLink with a4j:param (for downloading file).
My code is :
<rich:dataTable value="#{dataBean.dataList}" var="entry"> ... <h:column> <h:commandLink title="Download" action="#{dataBean.download}" immediate="true"> <a4j:param value="#{entry.id}" assignTo="#{dataBean.selectedId}" /> <img src="#{resource['download_img']}" /> </h:commandLink> </h:column> </rich:dataTable>
When I click on the button, I got a NPE in :
org.richfaces.renderkit.AjaxCommandRendererBase.isSubmitted(FacesContext, UIComponent) line: 83
Is there a workaround ?
EDIT :
Finally it went OK using the workaround described in the bug RF-13018.
But I had to replace all type="button" by type="submit" for each a4j:commandButton in the project.
Thanks