Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2774

Form in form error when forms are not inside one another.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 5.8.2
    • None
    • tapestry-core
    • None

    Description

      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.

      Attachments

        1. Test.java
          1 kB
          Maximillian Steinbach
        2. Test.tml
          0.7 kB
          Maximillian Steinbach

        Activity

          People

            ben-ng Ben Weidig
            maxstein Maximillian Steinbach
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: