tags:

views:

353

answers:

3

Hi, sorry if I am being thick but what is the execute="@all" in an f:ajax tag really supposed to do? I expected it to submit all the elements on a page but it seems to POST only the values in the enclosing form, not all forms on page.

For example

<h:body>
    <h:form id="form1">
        Input1/Form1 <h:inputText id="testinput" value="#{testBean.input1}" />                              
    </h:form>

    <h:form id="form2">
        Input2/form2 <h:inputText id="testinput2" value="#{testBean.input2}" />                             
        <h:commandButton value="Ok" actionListener="#{testBean.al}">
        <f:ajax execute="@all" />
        </h:commandButton>
    </h:form>
</h:body>

Only form2 is posted on click.

Using mojarra 2.0.2..

A: 

Have you tried this?

<f:ajax execute="form1 form2" />

Does it send both forms' data if you explicitly mention them?

AFAIK, you are right: @all represents the whole page.

Vítor Souza
A: 

It would have to be execute=":form1 form2" (if you have the default separator), but anyway no, it doesn't. It only sends the second one.

If you put @all in the first form, it only sends the first. At least on Safari 5/Firefox 3.6.3 anyway. I guess one would have to look at the mojarra javascript to find out more.

dave
A: 

Here is a quote from JavaServer Faces 2.0 - The complete reference, page 352:

The execute and render keywords accept a set of special keywords, each with the meaning shown in this table:

@all (using with execute): Every component on the page is submitted and processed. This is useful when you want to do a full-page submit.

I think this quite clearly states that the fields from all forms should be submitted with the AJAX request.

However, even with Mojarra 2.0.3 this doesn't happen. Despite of contents of the execute attribute (whether you put a list of forms or @all) only the enclosing form gets its' fields submitted. So this seems like a bug. I am raising an issue about this unless there are altering views?

Despite of the failure to submit data for the execute forms/fields, Mojarra seems to correctly process only the declared elements, so this bug only applies to the submitting part.

Tuukka Mustonen