[
https://issues.apache.org/jira/browse/TAP5-2774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839493#comment-17839493
]
Ben Weidig commented on TAP5-2774:
----------------------------------
I tried to reproduce the issue without success.
Can you provide a rudimentary/stripped-down example?
This is my working setup of a page with a form in a zone that tirggers the
rerender of another component with a form which is in another zone:
{code:java}
public class FormTest {
@Inject
private Request request;
@Inject
private AjaxResponseRenderer ajax;
@InjectComponent
private Zone outer, rerender;
@OnEvent(EventConstants.SUBMIT)
public Object onSubmit() {
this.ajax.addRender(this.rerender);
return this.outer;
}
}
{code}
{code:xml}
<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
<t:zone t:id="outer">
<t:form t:id="A" t:zone="^">
<t:submit />
</t:form>
</t:zone>
<t:zone t:id="rerender">
<t:formTestComponent />
</t:zone>
</t:layout>
{code}
The component containts another t:form
Even though I've seen the "nested form" Exception many times in my own apps, it
was usually a subsequent issue with a previous Exception already creating an
inhospitable rendering environment that leads to the additional Exception.
However, it would be nicer to have a more expressive Exception at that point.
> Form in form error when forms are not inside one another.
> ---------------------------------------------------------
>
> Key: TAP5-2774
> URL: https://issues.apache.org/jira/browse/TAP5-2774
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core
> Affects Versions: 5.8.2
> Reporter: Maximillian Steinbach
> Priority: Critical
>
> I have t:form (form A) with an onSubmit action. This form's submit action
> triggers an ajax reload. The part of the page that is being reloaded is
> different to that of form A. The area being reloaded contains another t:form
> (form B) that must be re-rendered. While it is re-rendering form B it hits an
> exception at
> org.apache.tapestry5.corelib.components.Form.setupRender(Form.java:330)
> The error is "Form components may not be placed inside other Form
> components."
> It seems that there is a check here to see if there is an existing outer
> enclosing form in the process of being rendered. However the existing form it
> finds is the form A that is not an enclosing form, it is the form that
> triggers the submit action. Form A seems to be pushed into the environment on
> line 503 in the method onAction.
> I have taken a look at the git history here and there doesn't seems to have
> been any recent changes to this code so I am confused why this issue has
> begun on my end.
> As such, the result of this bug seems to be that a form's onSubmit action can
> never trigger the reload of another component that itself contains a form.
> This seems to be problematic.
> I can take a look at addressing this issue myself but I would appreciate
> other's more experienced input first before I attempt it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)