[ 
https://issues.apache.org/jira/browse/MYFACES-4606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732274#comment-17732274
 ] 

Werner Punz edited comment on MYFACES-4606 at 6/14/23 7:21 AM:
---------------------------------------------------------------

Added the PR for 4.0 as well, I will check 2.2 tomorrow whether the issue is 
there as well.

—

4.0 also is fixed and merged (did that in the night)

2.2 is a different issue, the fix for 4606 can go in same issue, same minor 
fix, but fixing 4533 would basically mean we backport a ton of stuff we have 
for 2.3 onwards into the 2.2 codebase, which was not wanted! The reason the 
4533 fix was not merged before was because it was forgotten by me to push it so 
when I merged the fixes for 4606 back into 2.3 I noticed that.

4533 is a corner case so not sure whether this is feasible to port this over 
for now given we do not want to change the code anymore!

 

Either way

I will prepare and merge the fix for 4606 for 2.2 tonight!

—

Minor sidenote, the new codebase also can compile into a JSF 2.x compliant 
codebase, so if the need arises in the future to solidify all branches into one 
source code (which probably never will) the door is open and I will keep it 
open as long as possible!

Retiring 2.2 in the long run also will be a minor help, given that from 2.3 
onwards all 2.x and 3.x branches are more or less on the same code level!

–

I will close the issue as soon as 2.2 is fixed and merged!

 

 

 

 

 

 


was (Author: werpu):
Added the PR for 4.0 as well, I will check 2.2 tomorrow whether the issue is 
there as well.

 

> Missing source button id:value pair from request parameters in ajax requests
> ----------------------------------------------------------------------------
>
>                 Key: MYFACES-4606
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4606
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions: 2.0.24, 2.2.15, 2.3.10, 3.0.2, 2.3-next-M8, 4.0.1
>            Reporter: Volodymyr Siedlecki
>            Assignee: Werner Punz
>            Priority: Major
>
>  When the non-ajax submit button is pressed, its id and value is sent as a 
> request parameter.  If the ajax equivalent button is pressed, the id-value 
> pair is missing.  However, the id is included under the "javax.faces.source" 
> attribute, per the spec. 
> This becomes a problem if you do some binding checks to see if a particular 
> button is pressed. See the link: 
> [https://stackoverflow.com/a/14730658/11402059]
> Here's a sample of the behaviors for ajax and non ajax submissions.  The 
> required parts are in red (which should appear in both requests):
> {code:java}
> <h:form id="form1">
> <div> Ajax Checkboxes: </div>
> <h:selectManyCheckbox id="ajaxCheckbox" required="#{not empty 
> ajaxbtn.clientId}"> 
>    <f:selectItem itemValue = "1" itemLabel = "Item 1" /> 
>    <f:selectItem itemValue = "2" itemLabel = "Item 2" /> 
> </h:selectManyCheckbox>
> Message for ajaxCheckbox -> <h:message for="ajaxCheckbox" />
> <br/>
> <div> Non-Ajax Checkboxes: </div>
> <h:selectManyCheckbox id="nonajaxCheckbox" required="#{not empty 
> nonajaxbtn.clientId}"> 
>    <f:selectItem itemValue = "3" itemLabel = "Item 3" /> 
>    <f:selectItem itemValue = "4" itemLabel = "Item 4" /> 
> </h:selectManyCheckbox>
> Message for nonajaxCheckbox -> : <h:message for="nonajaxCheckbox" />
> <br/>
> <!-- Added this button to see parameters passed when using ajax -->
> <h:commandButton id="ajaxbtn" value="Ajax Submit" binding="#{ajaxbtn}">
>      <f:ajax event="click" execute="@form" render="@form"/>
> </h:commandButton>
> <h:commandButton id="nonajaxbtn" value="Non Ajax Submit" 
> binding="#{nonajaxbtn}"/>
> <c:forEach items="#{param}" var="entry">
>      <p style="#{entry.key == 'form1:nonajaxbtn' or entry.key == 
> 'form1:ajaxbtn'  ? 'color:red;' : 'color:black;'}"><h:outputText 
> value="#{entry.key}" /> : <h:outputText value="#{entry.value}" /></p>
> </c:forEach>
> </h:form>
> {code}
>  
> It used to work in 2.0, but now fails after refactoring.  Haven't tested on 
> 4.0, but I think it's also affected.
> 2.3.x: 
> [https://github.com/apache/myfaces/blob/2.3.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js#L38-L63]
>  
>  
> 2.0.5: 
> [https://github.com/apache/myfaces/blob/myfaces-core-project-2.0.5/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxUtils.js#L57]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to