Re: T5 - Cancelling a form
There was a discussion last week on the same topic. Howard said that the best way was to keep a flag like cancelSelected and turn it on on the selected event. Then in the form submit event look to it and do what it needs to do. I think that it is very incovenient, it's a common use case having a lot of buttons, there should be a way to make events from submits button act like listeners in tap4, so they are called at last, when all the form has been processed, so it can redirect to another page. On 3/24/07, Bogdan Calmac [EMAIL PROTECTED] wrote: What is the recommended way to handle a Cancel button on a form? The expected behaviour would be to clear the internal state, bypass validation and move to a different page. I tried: @OnEvent(component=Cancel) String onCancel() { surveySession.setSurvey(null); return Start; } where Cancel is the id of the submit component but Tapestry complains that this method cannot return a String: Event 'selected' from org.byteberry.survey.pages.SurveyDetail:cancel received an event handler method return value of Start from org.byteberry.survey.pages.SurveyDetail.onCancel() (at SurveyDetail.java:46). This type of event does not support return values from event handler methods. On the other hand, if I try do do it on the form events I don't know which button was pressed and I cannot bypass validation. Is there a straightforward way to do it? Thanks, Bogdan Calmac. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Cancelling a form
Pablo Ruggia wrote: There was a discussion last week on the same topic. Howard said that the best way was to keep a flag like cancelSelected and turn it on on the selected event. Then in the form submit event look to it and do what it needs to do. I think that it is very incovenient, it's a common use case having a lot of buttons, there should be a way to make events from submits button act like listeners in tap4, so they are called at last, when all the form has been processed, so it can redirect to another page. In my opinion forms should be as simple as possible. From a UI design perspective that helps to avoid user confusion. So either you leave a form to save the input or you want to abandon it. Leads to only two submit buttons. If you need additional buttons to do additional processing while you are in the form, you can always be notified via the OnSelect... callbacks, but you should stay in the form and not leave it. Stephan -- http://www.stephan-schwab.com -- View this message in context: http://www.nabble.com/T5---Cancelling-a-form-tf3458631.html#a9651520 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Cancelling a form
How about a:actionlink t:id=cancelcancel/a ? Why should it be necessary to do a form submission, just to discard all the data in the form? If you want, you can use CSS to dress up the link to look like a form submit button. I think having this cancel feature in T4 was a mistake that caused more problems than it solved. On 3/24/07, Stephan Schwab [EMAIL PROTECTED] wrote: Pablo Ruggia wrote: There was a discussion last week on the same topic. Howard said that the best way was to keep a flag like cancelSelected and turn it on on the selected event. Then in the form submit event look to it and do what it needs to do. I think that it is very incovenient, it's a common use case having a lot of buttons, there should be a way to make events from submits button act like listeners in tap4, so they are called at last, when all the form has been processed, so it can redirect to another page. In my opinion forms should be as simple as possible. From a UI design perspective that helps to avoid user confusion. So either you leave a form to save the input or you want to abandon it. Leads to only two submit buttons. If you need additional buttons to do additional processing while you are in the form, you can always be notified via the OnSelect... callbacks, but you should stay in the form and not leave it. Stephan -- http://www.stephan-schwab.com -- View this message in context: http://www.nabble.com/T5---Cancelling-a-form-tf3458631.html#a9651520 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Cancelling a form
Howard Lewis Ship wrote: How about a:actionlink t:id=cancelcancel ? Why should it be necessary to do a form submission, just to discard all the data in the form? If you want, you can use CSS to dress up the link to look like a form submit button. Right. Actually that's pretty smart and more in compliance with the original idea of the reset in pure HTML. Stephan -- http://www.stephan-schwab.com -- View this message in context: http://www.nabble.com/T5---Cancelling-a-form-tf3458631.html#a9652893 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Cancelling a form
Thanks Howard, The CSS hack would problably work but I'd rather consider other options. I could for instance use some image buttons which have the same look and feel for both Submit and Cancel. Does tapestry provide the equivalent of input type=image for form submission? Bogdan. On 3/24/07, Stephan Schwab [EMAIL PROTECTED] wrote: Howard Lewis Ship wrote: How about a:actionlink t:id=cancelcancel ? Why should it be necessary to do a form submission, just to discard all the data in the form? If you want, you can use CSS to dress up the link to look like a form submit button. Right. Actually that's pretty smart and more in compliance with the original idea of the reset in pure HTML. Stephan -- http://www.stephan-schwab.com -- View this message in context: http://www.nabble.com/T5---Cancelling-a-form-tf3458631.html#a9652893 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]