Details
Description
There's an issue with some examples that use singleSubmit. For example, the Comp Suite Context Menu: Effects demo allows you to choose which effect to use when visually displaying the menu. The markup in question currently looks like this:
<ui:define name="example">
<h:form>
<icecore:singleSubmit/>
<h:panelGrid columns="3">
...
This doesn't work properly when running under MyFaces. Clicking a radio button does trigger a submit, but the resulting update simply resets the radio back to the default selection. Changing it to use an f:ajax tag appears to clear things up:
<ui:define name="example">
<h:form>
<f:ajax execute="@this" render="@all">
<h:panelGrid columns="3">
...
This isn't related to ACE at all. I can pare down the example to a very simply one using only stock components and the behaviour is the same.
<ui:define name="example">
<h:form>
<icecore:singleSubmit/>
<h:panelGrid columns="3">
...
This doesn't work properly when running under MyFaces. Clicking a radio button does trigger a submit, but the resulting update simply resets the radio back to the default selection. Changing it to use an f:ajax tag appears to clear things up:
<ui:define name="example">
<h:form>
<f:ajax execute="@this" render="@all">
<h:panelGrid columns="3">
...
This isn't related to ACE at all. I can pare down the example to a very simply one using only stock components and the behaviour is the same.
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Assigned to Ted.
Attached test case contains 2 identical pages except that one uses singleSubmit (ss.xhtml) and one uses f:ajax (fajax.xhtml). You can build it by unzipping it to the icefaces2/samples/core directory and using the normal build mechanisms:
Mojarra:
ant clean servlet-profile
MyFaces:
ant -Dmyfaces="true" clean servlet-profile
Show
Deryk Sinotte
added a comment - Assigned to Ted.
Attached test case contains 2 identical pages except that one uses singleSubmit (ss.xhtml) and one uses f:ajax (fajax.xhtml). You can build it by unzipping it to the icefaces2/samples/core directory and using the normal build mechanisms:
Mojarra:
ant clean servlet-profile
MyFaces:
ant -Dmyfaces="true" clean servlet-profile
So it appears that, when using singleSubmit with MyFaces, the "javax.faces.execute" parameter does not include the name of the component. For example, if you run the test case and run the ss.xhtml page:
javax.faces.partial.execute:@this j_id76603324_490dfe1:theColours:0
Running the fajax.xhtml page:
javax.faces.partial.execute:j_id779036716_2e6f2877:theColours
MyFaces looks like it processes things differently with the f:ajax tag whereas with singleSubmit, from the client perspective, it doesn't look like an Ajax request.
Including the element.name is important for things like radio buttons and checkboxes because the id of the radio button/checkbox is indexed:
j_id76603324_490dfe1:theColours:0
but the actual component doesn't include this
j_id76603324_490dfe1:theColours
Without the element.name in this case, MyFaces fails to run the partial execution against the component and it doesn't get decode() 'd.
Mojarra appears to append the element.name to the outgoing request regardless.
if (options.execute) {
{ options.execute = element.name + " " + options.execute; }none = options.execute.search(/@none/);
if (none < 0) {
all = options.execute.search(/@all/);
if (all < 0) {
options.execute = options.execute.replace("@this", element.id);
options.execute = options.execute.replace("@form", form.id);
var temp = options.execute.split(' ');
if (!isInArray(temp, element.name))
} else
{ options.execute = "@all"; }args["javax.faces.partial.execute"] = options.execute;
{ options.execute = element.name + " " + element.id; args["javax.faces.partial.execute"] = options.execute; }}
} else
So I've checked in a change to submit.js that appends the element.name to the execute parameter for radio buttons and checkboxes (if it's not already there) which fixes the issue we are seeing. The fix is currently only applied to singleSubmit for radio buttons and checkboxes as that's the only place we are currently seeing this behaviour.