JSF: ejecutar valores de múltiples formas

I want to submit (execute) values from multiple forms, not just the enclosing form. So, I want to be able to do something like this:

<h:form id="form1>
    <h:inputText id="testinput1" value="#{testBean.input1}" />

<h:form id="form2>
    <h:inputText id="testinput2" value="#{testBean.input2}" />

    <h:commandButton value="Submit">
        <f:ajax execute=":form1 :form2"/>

Como resolverias esto?

What is <f:ajax execute="@all"> really supposed to do? It POSTs only the enclosing form seems to be related, but addresses a slightly different problem and also does not solve it (or this).

preguntado el 09 de marzo de 12 a las 17:03

1 Respuestas

Ajax or not, this is not possible with plain JSF/HTML. All input elements which needs to be processed really needs to go inside the same form.

respondido 09 mar '12, 17:03

@Matt: that's correct. There's however difference for them in the render atributo. - BalusC

Thanks for clarification, BalusC. Is this per specification or a constraint from html/js? - mate práctico

@Matt: the spec has never stated that @all will execute all forms. Technically, it's also impossible (although it's easy for JS to workaround this by merging the form values, but in JSF the view state and action is dependent on the form). IMO the @all should never have been one of the available values of execute. It adds no value and is only confusing. - BalusC

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.