Totally. Thanks very much for clarifying that. It could be worth adding
that information to the javadoc for the wicket form.

-Matt

>>> [EMAIL PROTECTED] 04/20/05 08:04p.m. >>>

when a form has multiple submit buttons, the onSubmit method for the 
form is not called.  instead, the button's onSubmit is called.

since wicket actually counts the number of submit buttons when the form

is submitted in order to decide which thing to do, the code below will

call the form's onSubmit() since it only has a cancel button.  to get 
the cancel button's on submit to be called, you would have to add some

other button like an okay button. 

so, there are two modes for form submit.  one where the form is 
submitted by a single button and the other where it is submitted by two

or more buttons.  make sense?

         jon

Matthew Watson wrote:

>Could somebody give me an example of a form that has multiple submit
>buttons? 
>
>I've seen references to using the Wicket button class but when I try
>this it doesn't seem to work.
>
>public class CreatePage extends WebPage {
>
>    public CreatePage() {
>        super();
>
>        add(new CreateForm("form"));
>    }
>
>    private static class CreateForm extends Form {
>
>        public CreateForm(String s) {
>            super(s);
>
>            add(new CancelButton("cancel"));
>        }
>
>        protected void onSubmit() {
>            // What goes here?
>        }
>
>        private static class CancelButton extends Button {
>
>            public CancelButton(String s) {
>                super(s);
>            }
>
>            protected void onSubmit() {
>                final RequestCycle cycle = getRequestCycle();
>
>               
>cycle.setResponsePage(getPageFactory().newPage(CancelPage.class));
>                cycle.setRedirect(true);
>            }
>        }
>    }
>}
>
>What am I doing wrong here...?
>
>PS: I've searched the wiki and the archive of mail messages without
>much success.
>
>Thanks, 
>Matt
>
>********************************************************************************
>This email may contain legally privileged information and is intended
only for the addressee. It is not necessarily the official view or 
>communication of the New Zealand Qualifications Authority. If you are
not the intended recipient you must not use, disclose, copy or
distribute this email or 
>information in it. If you have received this email in error, please
contact the sender immediately. NZQA does not accept any liability for
changes made to this email or attachments after sending by NZQA. 
>
>All emails have been scanned for viruses and content by MailMarshal. 
>NZQA reserves the right to monitor all email communications through
its network.
>
>********************************************************************************
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: New Crystal Reports XI.
>Version 11 adds new functionality designed to reduce time involved in
>creating, integrating, and deploying reporting solutions. Free runtime
info,
>new features, or free trial, at:
http://www.businessobjects.com/devxi/728 
>_______________________________________________
>Wicket-user mailing list
>[email protected] 
>https://lists.sourceforge.net/lists/listinfo/wicket-user 
>
>  
>


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime
info,
new features, or free trial, at:
http://www.businessobjects.com/devxi/728 
_______________________________________________
Wicket-user mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/wicket-user

********************************************************************************
This email may contain legally privileged information and is intended only for 
the addressee. It is not necessarily the official view or 
communication of the New Zealand Qualifications Authority. If you are not the 
intended recipient you must not use, disclose, copy or distribute this email or 
information in it. If you have received this email in error, please contact the 
sender immediately. NZQA does not accept any liability for changes made to this 
email or attachments after sending by NZQA. 

All emails have been scanned for viruses and content by MailMarshal. 
NZQA reserves the right to monitor all email communications through its network.

********************************************************************************


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to