Tapestry
  1. Tapestry
  2. TAPESTRY-1673

Why does submitType="cancel" kill its listener?

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.6
    • Component/s: Core Components
    • Labels:
      None
    • Environment:
      Tap 4.1.2, Firefox 2.0.0.5 or IE 7 on Win XP SP2, Safari 2.0.4 or Firefox 2.0.0.5 on OS X 10.4.10, served by Tomcat in JBoss 4.2.1.

      Description

      Is there a reason why submitType kills its component's listener? For example, whereas this listener works...

      <input jwcid="@Submit" type="submit" value="Cancel" action="listener:doCancel">

      ... the listener in this one is ignored...

      <input jwcid="@Submit" type="submit" value="Cancel" action="listener:doCancel" submitType="cancel"/>

      ...and the listener has to be specified on the Form instead...

      <form jwcid="@Form" cancel="listener:doCancel">

      Why is this so? What if I want more than one button of type cancel, each one with its own listener, and possibly its own parameters? I think submitType="refresh" behaves this way, too.

      Here's a working example:

      package sandpit;

      import org.apache.tapestry.html.BasePage;

      public abstract class CancelPage extends BasePage {
      public abstract void setMessage1(String value);
      public abstract void setMessage2(String value);

      public void doComponentListener()

      { setMessage1("doComponentListener() invoked."); }

      public void doFormListener()

      { setMessage2("doFormListener() invoked."); }

      }

      <html jwcid="@Shell" title="">
      <body jwcid="@Body">
      <h2>Demonstration of how submitType="cancel" kills the component's listener</h2>

      <form jwcid="@Form">
      <fieldset>
      <legend>This form does NOT specify a cancel listener</legend>

      Whereas this listener works...<br/>
      <input jwcid="@Submit" type="submit" value="Submit" action="listener:doComponentListener"/> GOOD<br/>
      <code><input jwcid="@Submit" type="submit" value="Submit" action="listener:doComponentListener"/></code><br/><br/>

      ... the listener in this one is ignored, which is bad...<br/>
      <input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel" action="listener:doComponentListener"/> BAD<br/>
      <code><input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel" action="listener:doComponentListener"/></code><br/><br/>
      </fieldset>
      </form>

      <form jwcid="@Form" cancel="listener:doFormListener">
      <fieldset>
      <legend>This form specifies cancel="listener:doFormListener"</legend>

      Whereas this listener works...<br/>
      <input jwcid="@Submit" type="submit" value="Submit" action="listener:doComponentListener"/> GOOD<br/>
      <code><input jwcid="@Submit" type="submit" value="Submit" action="listener:doComponentListener"/></code><br/><br/>

      ... the listener in this one is ignored, and the form's listener takes over, which is questionable...<br/>
      <input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel" action="listener:doComponentListener" /> QUESTIONABLE<br/>
      <code><input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel" action="listener:doComponentListener"/></code><br/><br/>

      ...but in this case the form's listener works... <br/>
      <input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel"/> GOOD<br/>
      <code><input jwcid="@Submit" type="submit" value="Cancel" submitType="cancel"/></code><br/><br/>
      </fieldset>
      </form>

      Message1: <span style="color: red;"><span jwcid="@Insert" value="ognl:message1">Message</span></span><br/>
      Message2: <span style="color: blue;"><span jwcid="@Insert" value="ognl:message2">Message</span></span>
      </body>
      </html>

        Activity

        Geoff Callender created issue -
        Geoff Callender made changes -
        Field Original Value New Value
        Attachment CancelPage screenshot.jpg [ 12362605 ]
        Andreas Andreou made changes -
        Assignee Andreas Andreou [ andyhot ]
        Andreas Andreou made changes -
        Fix Version/s 4.1.4 [ 12312763 ]
        Andreas Andreou made changes -
        Priority Major [ 3 ] Critical [ 2 ]
        Jesse Kuhnert made changes -
        Fix Version/s 4.1.6 [ 12312957 ]
        Fix Version/s 4.1.5 [ 12312935 ]
        Andreas Andreou made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Mark Thomas made changes -
        Workflow jira [ 12409277 ] Default workflow, editable Closed status [ 12568647 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568647 ] jira [ 12590104 ]

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            Geoff Callender
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development