Thank you very much. You are right, of course, the rewind is going to take place.
In our case, though, we have a form component that don't accept listeners and only invokes que listener of the submit element, so it's ok to get the cancel submit and simply do the action (go to the previous page) without paying atention to the validation result. To be really sure that javascript avaliability doesn't change the app behaviour we don't try to bypass the server validation with the javascript on the button, only to disable client validation. I hope this is going to work. It seems it does. Regards Pedro El Mér, 19-10-2005 a las 12:26 -0400, Howard Lewis Ship escribió: > The rewind process isn't completely skipped; the Form just doesn't > render its body, so its ok that pageBeginRender() is invoked. > > I think to handle a javascript on or off, you'll want the following: > > <component id="form" type="Form"> > <binding name="success" value="listener:doSubmit"'/> > <binding name="cancel" value="listener:doCancel"/> > </component> > > <component id="cancel" type="Submit"> > <binding name="action" value="listener:doCancel"/> > <binding name="onclick"> > literal: javascript:this.form.events.cancel(); > </binding> > </component> > > > Now ... if JavaScript is enabled, the event.cancel() JavaScript will > force a cancel submission and only doCancel() will be invoked. > > If JavaScript is disabled, it will be a normal submission, with a full > rewind; doCancel() will be invoked *BEFORE* doSubmit(). This is > because the the Form can't tell that this is a cancel submission > without client-side JavaScript enabled. > > You'll see some properties updated via other form element components; > the success listener may not be invoked if the delegate records any > errors, but this should cover all the cases otherwise. > > On 10/19/05, Pedro Abelleira Seco <[EMAIL PROTECTED]> wrote: > > I think you don't even need to expect javascript on the client. If you > > don't have it you don't need to cancel the validation, as it's not going > > to happen, anyway. > > > > It's important for me, as my application _must_ work with javascript > > either enabled or disabled. > > > > Good tip, thanks. > > > > > > El Mér, 19-10-2005 a las 08:17 -0400, Howard Lewis Ship escribió: > > > If you can expect JavaScript on the client, the best way is: > > > > > > <input type="submit" value="Cancel" > > > onclick="javascript:this.form.events.cancel();"/> > > > > > > This will submit the form, bypass client-side handlers of all kinds, > > > bypass rewind on the server, and invoke the Form's cancel listener. > > > > > > On 10/19/05, Vjeran Marcinko <[EMAIL PROTECTED]> wrote: > > > > Hi. > > > > > > > > Canceling form has been problematic prior to 4.0, but now, Form has > > > > "cancel" > > > > listener that would avoid rewind process, and it says in description > > > > that it > > > > should be invoked by javascript event. > > > > > > > > Does it mean that proper way to achieve "Cancel" button (beside > > > > "Submit") is > > > > to use Button component that would have "onclick" handler doing form > > > > cancellation ? > > > > > > > > Regards, > > > > Vjeran > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > Howard M. Lewis Ship > > > Independent J2EE / Open-Source Java Consultant > > > Creator, Jakarta Tapestry > > > Creator, Jakarta 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] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Howard M. Lewis Ship > Independent J2EE / Open-Source Java Consultant > Creator, Jakarta Tapestry > Creator, Jakarta 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
