Eduardo Breijo created MYFACES-4229:
---------------------------------------

             Summary: Regression in Spec Issue 790: Cross form submit
                 Key: MYFACES-4229
                 URL: https://issues.apache.org/jira/browse/MYFACES-4229
             Project: MyFaces Core
          Issue Type: Task
          Components: JSR-372
    Affects Versions: 2.3.1
            Reporter: Eduardo Breijo


After releasing MyFaces 2.3.1, I noticed a regression in cross form submit from 
Spec Issue 790: [https://github.com/javaee/javaserverfaces-spec/issues/790]

HTML sample code:
{code:java}
<h:form id="a"> 
<h:outputText value="This is 'form a' " /> 
<h:outputLabel for="input1" value="Enter a new value for input1: " /> 
<h:inputText id="input1" value="#{simpleBean.input}" /> 
<h:commandButton id="submitButton1" value="Click here to execute 'form a' and 
'form b' but re-render 'form b'"> 
<f:ajax execute="a :b" render=":b" /> 
</h:commandButton> 
</h:form> 
<h:form id="b"> 
<h:outputText value="This is 'form b' " /> 
<h:outputLabel for="input2" value="Enter a new value for input2: " /> 
<h:inputText id="input2" value="#{simpleBean.input}" /> 
<h:commandLink id="commandLink1" value="Click here to execute 'form a' and 
'form b'  but re-render 'form a'"> 
<f:ajax execute="b :a" render=":a" /> 
</h:commandLink> 
</h:form>
{code}
 

The issue is that on MyFaces 2.3.1 the hidden input javax.faces.ViewState is 
being removed from form "b" after the we submit form "a" and viceversa.

 

Rendered page on MyFaces 2.3.0

 
{code:java}
<form id="a" name="a" method="post" action="/JSF23Spec790/test1.xhtml" 
enctype="application/x-www-form-urlencoded"> This is 'form a' 
<label for="a:input1"> Enter a new value for input1: </label> 
<input id="a:input1" name="a:input1" type="text" value="test"/> 
<input id="a:submitButton1" name="a:submitButton1" type="submit" value="Click 
here to execute 'form a' and 'form b' but re-render 'form b'" 
onclick="jsf.util.chain(this, event,'jsf.ajax.request(this,event,{execute:\'a b 
\',render:\'b \',\'javax.faces.behavior.event\':\'action\'})'); return 
false;"/> <input type="hidden" name="a_SUBMIT" value="1"/> 
<input type="hidden" name="javax.faces.ViewState" 
id="j_id__v_0:javax.faces.ViewState:1" value="RjhDMEFGQUMwNDI4NTUwRDAwMDAwMDAx" 
autocomplete="off"/> 
</form> 

<form id="b" name="b" method="post" action="/JSF23Spec790/test1.xhtml" 
enctype="application/x-www-form-urlencoded"> This is 'form b' 
<label for="b:input2"> Enter a new value for input2: </label> 
<input id="b:input2" name="b:input2" type="text" value="test"/> 
<a href="#" onclick="jsf.util.chain(this, 
event,'jsf.ajax.request(this,event,{execute:\'b a \',render:\'a 
\',\'javax.faces.behavior.event\':\'action\'})'); return false;" 
id="b:commandLink1" name="b:commandLink1"> Click here to execute 'form a' and 
'form b' but re-render 'form a' </a> 
<input type="hidden" name="b_SUBMIT" value="1"/> 
<input type="hidden" id="javax.faces.ViewState:0" name="javax.faces.ViewState" 
value="RjhDMEFGQUMwNDI4NTUwRDAwMDAwMDAx"/> 
</form>
{code}
 

 

Rendered page on MyFaces 2.3.1

 
{code:java}
<form id="a" name="a" method="post" action="/JSF23Spec790/test1.xhtml" 
enctype="application/x-www-form-urlencoded"> This is 'form a' 
<label for="a:input1"> Enter a new value for input1: </label> 
<input id="a:input1" name="a:input1" type="text" value="test"/> 
<input id="a:submitButton1" name="a:submitButton1" type="submit" value="Click 
here to execute 'form a' and 'form b' but re-render 'form b'" 
onclick="jsf.util.chain(this, event,'jsf.ajax.request(this,event,{execute:\'a b 
\',render:\'b \',\'javax.faces.behavior.event\':\'action\'})'); return 
false;"/> <input type="hidden" name="a_SUBMIT" value="1"/> 
<input type="hidden" name="javax.faces.ViewState" 
id="j_id__v_0:javax.faces.ViewState:1" value="RjY3MjAyMTY3N0U2ODE3RDAwMDAwMDAx" 
autocomplete="off"/> 
</form> 
<form id="b" name="b" method="post" action="/JSF23Spec790/test1.xhtml" 
enctype="application/x-www-form-urlencoded"> This is 'form b' 
<label for="b:input2"> Enter a new value for input2: </label> 
<input id="b:input2" name="b:input2" type="text" value="test"/> <a href="#" 
onclick="jsf.util.chain(this, event,'jsf.ajax.request(this,event,{execute:\'b a 
\',render:\'a \',\'javax.faces.behavior.event\':\'action\'})'); return false;" 
id="b:commandLink1" name="b:commandLink1"> Click here to execute 'form a' and 
'form b' but re-render 'form a' </a> 
<input type="hidden" name="b_SUBMIT" value="1"/> 
</form>
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to