[ 
https://issues.apache.org/jira/browse/TAPESTRY-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Andreou updated TAPESTRY-1673:
--------------------------------------

    Priority: Critical  (was: Major)

> Why does submitType="cancel" kill its listener?
> -----------------------------------------------
>
>                 Key: TAPESTRY-1673
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1673
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Core Components
>    Affects Versions: 4.1.2
>         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.
>            Reporter: Geoff Callender
>            Assignee: Andreas Andreou
>            Priority: Critical
>             Fix For: 4.1.4
>
>         Attachments: CancelPage screenshot.jpg
>
>
> 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>&lt;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>&lt;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>&lt;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>&lt;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>&lt;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>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to