Re: AjaxButton's onSubmit goes into Form Submit? Why?

2011-02-02 Thread Igor Vaynberg
then make it an AjaxLink

-igor

On Wed, Feb 2, 2011 at 2:12 PM, eugenebalt eugeneb...@yahoo.com wrote:

 I have an Ajax Button which is NOT a submit button; it's a custom button that
 does my own action.

 AjaxButton reportButton = new AjaxButton(reportButton) {

        @Override
        protected void onSubmit(AjaxRequestTarget arg0, Form? arg1) {
                // TODO Auto-generated method stub
                          //
 };
 add(reportButton);

 The button is in the HTML as
 input wicket:id=reportButton  type=button  value=Report /


 When I click the button, the Form's OnSubmit() gets executed for some
 reason. I can see that if I place debug statements in that method. Why is
 that? I don't want to submit the form on clicking this AjaxButton.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxButton-s-onSubmit-goes-into-Form-Submit-Why-tp3256022p3256022.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxButton's onSubmit goes into Form Submit? Why?

2011-02-02 Thread eugenebalt

OK thanks, that did the trick.

But I have one more question: That AjaxLink is supposed to start a browser
File Download. The code that I have for that works like a charm in the Form
OnSubmit, but it doesn't work inside the Ajax Link.

File f = generateFile();
ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(
new FileResourceStream(f));
target.setFileName(report.xls);
RequestCycle.get().setRequestTarget(target);


This code works in the form's OnSubmit(), but not in the AjaxLink. Do  you
know how to start the download in the AjaxLink?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxButton-s-onSubmit-goes-into-Form-Submit-Why-tp3256022p3256219.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxButton's onSubmit goes into Form Submit? Why?

2011-02-02 Thread Igor Vaynberg
you dont need an ajax link to start a download. use a regular link instead.

-igor

On Wed, Feb 2, 2011 at 3:08 PM, eugenebalt eugeneb...@yahoo.com wrote:

 OK thanks, that did the trick.

 But I have one more question: That AjaxLink is supposed to start a browser
 File Download. The code that I have for that works like a charm in the Form
 OnSubmit, but it doesn't work inside the Ajax Link.

 File f = generateFile();
 ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(
        new FileResourceStream(f));
 target.setFileName(report.xls);
 RequestCycle.get().setRequestTarget(target);


 This code works in the form's OnSubmit(), but not in the AjaxLink. Do  you
 know how to start the download in the AjaxLink?
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxButton-s-onSubmit-goes-into-Form-Submit-Why-tp3256022p3256219.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxButton's onSubmit goes into Form Submit? Why?

2011-02-02 Thread eugenebalt

When you say regular link you mean a DownloadLink?

How do I construct it? I need to define either a File or a PropertyModel
(the 2nd arg). Not sure what to put in there. Thanks
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxButton-s-onSubmit-goes-into-Form-Submit-Why-tp3256022p3256300.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org