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

Leonardo Uribe commented on MYFACES-3911:
-----------------------------------------

According to the spec the behavior you are describing is expected. Ajax takes 
every input fields of the current form and send them into the request, but it 
doesn't send every input field of every form in the page. JSF lifecycle steps 
like decode and validation are not executed by the other form child components, 
because UIForm has a logic that checks if the form was submitted and if not it 
just skip child processing.

I'll close this issue as invalid. The reason is the fix can be done providing 
one parent form. There are components like tomahawk t:subform that help with 
cases like this one, but most of the time you don't need it, because f:ajax is 
flexible enough to define which components are executed and rendered per each 
request. 

> Can't execute a second form from another form
> ---------------------------------------------
>
>                 Key: MYFACES-3911
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3911
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.4
>         Environment: java 7, tomcat 7
>            Reporter: Rene O
>         Attachments: jsftest22.zip
>
>
> I have 2 forms within a site. I try to execute form B from form A, but it 
> doesn't work.
> {code}
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";
>       xmlns:f="http://xmlns.jcp.org/jsf/core";
>       xmlns:h="http://xmlns.jcp.org/jsf/html";
>       xmlns:ui="http://xmlns.jcp.org/jsf/facelets";
>       xmlns:p="http://xmlns.jcp.org/jsf/passthrough";
>       xmlns:jsf="http://xmlns.jcp.org/jsf";>
>       <h:head></h:head>
>       
>       <h:body>
>               <h:panelGroup id="pagePanel">
>                       1. type a character into input-field
>                       <br/>
>                       2. click button 'Button B'
>                       <br/>
>                       3. input-field validates and a message appears, which 
> is the expected behaviour
>                       <br/>
>                       4. change the character within input-field
>                       <br/>
>                       5. click 'Button A'
>                       <br/>
>                       6. now no validation takes place and no message 
> appears, which is not the expected behaviour
>                       <br/>
>                       --- formB is not executed, if you submit the page via 
> ajax from formA
>                       <br/>
>                       --- you can also see, that no value is submitted if you 
> insert a valid input in this case
>                       <br/>
>                       <br/>
>                       <h:messages />
>                       <h:form id="formA">
>                               <h:commandButton value="Button A">
>                                       <f:ajax execute="pagePanel" 
> event="click" render="pagePanel" />
>                               </h:commandButton>
>                       </h:form>
>                       <br/>
>                       <br/>
>                       <h:form id="formB">
>                               Input:
>                               <h:inputText id="inputA" value="#{model.value}" 
> required="true">
>                                       <f:validateLength minimum="5"/>
>                               </h:inputText>
>                               <br/>
>                               <br/>
>                               <h:commandButton value="Button B">
>                                       <f:ajax execute="pagePanel" 
> event="click" render="pagePanel" />
>                               </h:commandButton>
>                               <br/>
>                               <br/>
>                               Submitted input value: #{model.value}
>                       </h:form>
>               </h:panelGroup>
>       </h:body>
> </html>
> {code}
> A testcase is attached.
> Open URL
> {code}
> http://localhost:8080/jsftest22/mypage.jsf
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to