Re: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Denny
The error message is clear. This type of event does not support return
values from
event handler methods.

Please take a look at http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

Dealing with multiple submits Capter.


On 8/8/07, Kolesnikov, Alexander GNI [EMAIL PROTECTED] wrote:

 I am playing with a simple T5 application that has two pages: Start and
 Another.

 The Start page contains the following:

 p
 a href=# t:type=ActionLink t:id=actionRedirectDisplay
 Another page/a
 /p
 t:form t:id=theForm
 input type=submit value=Submit/
 t:submit t:id=submitRedirect value=Submit Redirect/
 /t:form

 And here is the page class contents:

 @InjectPage
 private Another anotherPage;

 @OnEvent(value=submit, component=theForm)
 Object onFormRedirect() {
 return anotherPage;
 }

 @OnEvent(component=actionRedirect)
 Object onActionRedirect() {
 return anotherPage;
 }

 @OnEvent(component=submitRedirect)
 Object onSubmitRedirect() {
 return anotherPage;
 }

 So basically the Start page provides three ways to navigate to Another
 page: by submitting the form (using HTML input type=submit), by
 clicking on the ActionLink and by by clicking on the Sunmit component.
 The latter, however, produces exception with the following message:

 Event 'selected' from Start:submitredirect received an event handler
 method return value of [EMAIL PROTECTED]
 from com.packtpub.foundations.pages.Start.onSubmitRedirect() (at
 Start.java:56). This type of event does not support return values from
 event handler methods.

 For me, this looks inconsistent. Okay, Submit control generates
 'selected' event, not 'submit', not 'action', but wouldn't it be natural
 to be able to navigate to another page as a result of a Submit button
 press?

 Thanks,

 Alexander



 --
 CONFIDENTIALITY NOTICE: If you have received this email in error, please
 immediately notify the sender by e-mail at the address shown.  This email
 transmission may contain confidential information.  This information is
 intended only for the use of the individual(s) or entity to whom it is
 intended even if addressed incorrectly.  Please delete it from your files if
 you are not the intended recipient.  Thank you for your
 compliance.  Copyright 2007 CIGNA

 ==




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com


RE: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Kolesnikov, Alexander GNI
Thank you, Denny.

Yes, I understand that it is done like this, but I am actually trying to
discuss the consistence of the framework design. Is there any specific
reason that 'select' event handler works differently from any other
event handler? If yes, then why Submit component generates exactly
'select' event? What exactly we are selecting when pressing a Submit
button? Why its event is not 'action'?

-Original Message-
From: Denny [mailto:[EMAIL PROTECTED] 
Sent: 08 August 2007 10:06
To: Tapestry users
Subject: Re: [T5] Submit control event handler cannot redirect?


The error message is clear. This type of event does not support return
values from event handler methods.

Please take a look at
http://wiki.apache.org/tapestry/Tapestry5HowToUseForms

Dealing with multiple submits Capter.


On 8/8/07, Kolesnikov, Alexander GNI [EMAIL PROTECTED]
wrote:

 I am playing with a simple T5 application that has two pages: Start 
 and Another.

 The Start page contains the following:

 p
 a href=# t:type=ActionLink t:id=actionRedirectDisplay 
 Another page/a /p
 t:form t:id=theForm
 input type=submit value=Submit/
 t:submit t:id=submitRedirect value=Submit Redirect/
 /t:form

 And here is the page class contents:

 @InjectPage
 private Another anotherPage;

 @OnEvent(value=submit, component=theForm)
 Object onFormRedirect() {
 return anotherPage;
 }

 @OnEvent(component=actionRedirect)
 Object onActionRedirect() {
 return anotherPage;
 }

 @OnEvent(component=submitRedirect)
 Object onSubmitRedirect() {
 return anotherPage;
 }

 So basically the Start page provides three ways to navigate to Another
 page: by submitting the form (using HTML input type=submit), by 
 clicking on the ActionLink and by by clicking on the Sunmit component.

 The latter, however, produces exception with the following message:

 Event 'selected' from Start:submitredirect received an event handler 
 method return value of [EMAIL PROTECTED]
 from com.packtpub.foundations.pages.Start.onSubmitRedirect() (at 
 Start.java:56). This type of event does not support return values from

 event handler methods.

 For me, this looks inconsistent. Okay, Submit control generates 
 'selected' event, not 'submit', not 'action', but wouldn't it be 
 natural to be able to navigate to another page as a result of a Submit

 button press?

 Thanks,

 Alexander



 --
 
 CONFIDENTIALITY NOTICE: If you have received this email in error,
please
 immediately notify the sender by e-mail at the address shown.  This
email
 transmission may contain confidential information.  This information
is
 intended only for the use of the individual(s) or entity to whom it is
 intended even if addressed incorrectly.  Please delete it from your
files if
 you are not the intended recipient.  Thank you for your
 compliance.  Copyright 2007 CIGNA

 ==
 




-- 
Regards

Denny
Site: http://dengyin2000.javaeye.com

--
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance.  Copyright 2007 CIGNA
==


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



RE: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Kolesnikov, Alexander GNI
Thank you very much, Nick!

-Original Message-
From: Nick Westgate [mailto:[EMAIL PROTECTED] 
Sent: 08 August 2007 10:21
To: Tapestry users
Subject: Re: [T5] Submit control event handler cannot redirect?


Think of it this way: the answer is no if you supply t:defer=false,
because then the redirect would occur before the form completed
rewinding.

That would be kind of like an exception. ;-)
http://wiki.apache.org/tapestry/Tapestry5RedirectException

I agree with you that's it's inconsistent though, and could be changed.
The event framework is definitely alpha, IHMO, with all the cool
features already implemented but some deeper issues yet to be resolved.

(In fact I'm about to post a JIRA improvement issue related to events.)

Cheers,
Nick.


Kolesnikov, Alexander GNI wrote:
 For me, this looks inconsistent. Okay, Submit control generates 
 'selected' event, not 'submit', not 'action', but wouldn't it be 
 natural to be able to navigate to another page as a result of a Submit

 button press?
 
 Thanks,
 
 Alexander
 
 
 --
 
 CONFIDENTIALITY NOTICE: If you have received this email in error,
please immediately notify the sender by e-mail at the address shown.
This email transmission may contain confidential information.  This
information is intended only for the use of the individual(s) or entity
to whom it is intended even if addressed incorrectly.  Please delete it
from your files if you are not the intended recipient.  Thank you for
your compliance.  Copyright 2007 CIGNA


==
 

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



--
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance.  Copyright 2007 CIGNA
==


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



Re: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Nick Westgate

The natural flow of form submission is to update internal state with posted
values from the form and then render the result page.

Whether that is the same page (which is often the case) or not is usually
decided at the end of the form processing. So the select events simply notify
us of which submit was selected (Save? Cancel?) and perhaps alter the final
outcome depending on validation etc.

(Again, IMHO. ;-)

Cheers,
Nick.


Kolesnikov, Alexander GNI wrote:

Yes, I understand that it is done like this, but I am actually trying to
discuss the consistence of the framework design. Is there any specific
reason that 'select' event handler works differently from any other
event handler? If yes, then why Submit component generates exactly
'select' event? What exactly we are selecting when pressing a Submit
button? Why its event is not 'action'?



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



RE: [T5] Submit control event handler cannot redirect?

2007-08-08 Thread Kolesnikov, Alexander GNI
I see, Nick. Things are much simpler with ActionLink because it isn't a
form component. 

Thanks a lot!

Alex

-Original Message-
From: Nick Westgate [mailto:[EMAIL PROTECTED] 
Sent: 08 August 2007 10:44
To: Tapestry users
Subject: Re: [T5] Submit control event handler cannot redirect?


The natural flow of form submission is to update internal state with
posted values from the form and then render the result page.

Whether that is the same page (which is often the case) or not is
usually decided at the end of the form processing. So the select events
simply notify us of which submit was selected (Save? Cancel?) and
perhaps alter the final outcome depending on validation etc.

(Again, IMHO. ;-)

Cheers,
Nick.


Kolesnikov, Alexander GNI wrote:
 Yes, I understand that it is done like this, but I am actually trying 
 to discuss the consistence of the framework design. Is there any 
 specific reason that 'select' event handler works differently from any

 other event handler? If yes, then why Submit component generates 
 exactly 'select' event? What exactly we are selecting when pressing a 
 Submit button? Why its event is not 'action'?


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



--
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance.  Copyright 2007 CIGNA
==


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