updating text in labels using ajax?
Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21072083.html Sent from the Wicket - User 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: updating text in labels using ajax?
Sure, use a simple Label and an AjaxButton, set setOutputMarkupId = true on the label and add it in the onSubmit method to the ajaxrequesttarget (target.addComponent(label)). But I'd also recommend taking a look at the Progressbar (search the mailinglist) - that might suits you better lizz wrote: Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21072177.html Sent from the Wicket - User 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: updating text in labels using ajax?
But the problem is that the user shouldnt have to press any button to update the labels... Michael Sparer wrote: Sure, use a simple Label and an AjaxButton, set setOutputMarkupId = true on the label and add it in the onSubmit method to the ajaxrequesttarget (target.addComponent(label)). But I'd also recommend taking a look at the Progressbar (search the mailinglist) - that might suits you better lizz wrote: Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21072220.html Sent from the Wicket - User 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: updating text in labels using ajax?
alright, so the label should either update itself or updates should be pushed to the client, right? did you have a look at how ProgressBar works? http://wicketstuff.org/confluence/display/STUFFWIKI/wicketstuff-progressbar i haven't tried it myself, but AFAIK it uses the approach to updateitself. I did a lot of stuff however with pushing data from the server to the client using cometd, but that seems a bit overhead to me for your usecase. but if you're interested in cometd either take a look at wicketstuff-push and/or wicketstuff-dojo-1.1 hope that helps lizz wrote: But the problem is that the user shouldnt have to press any button to update the labels... Michael Sparer wrote: Sure, use a simple Label and an AjaxButton, set setOutputMarkupId = true on the label and add it in the onSubmit method to the ajaxrequesttarget (target.addComponent(label)). But I'd also recommend taking a look at the Progressbar (search the mailinglist) - that might suits you better lizz wrote: Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21072506.html Sent from the Wicket - User 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: updating text in labels using ajax?
The submit button for your form is the AjaxButton that Michael mentioned below. You use that instead of a normal button and in the onSubmit method you fire off your web services and any other stuff you need. You also have available the AjaxRequestTarget which you then 'add' the label to the page again, which essentially refreshes the label. very simply: AjaxButton submitButton = new AjaxButton(submit) { protected void onSubmit(AjaxRequestTarget target, Form form) { target.addComponent(yourLabel); } }; You'll need to update your label text as well don't forget. But you could use a progressbar if you wanted as well. cheers, Steve On 18 Dec 2008, at 12:56, lizz wrote: But the problem is that the user shouldnt have to press any button to update the labels... Michael Sparer wrote: Sure, use a simple Label and an AjaxButton, set setOutputMarkupId = true on the label and add it in the onSubmit method to the ajaxrequesttarget (target.addComponent(label)). But I'd also recommend taking a look at the Progressbar (search the mailinglist) - that might suits you better lizz wrote: Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21072220.html Sent from the Wicket - User 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 smime.p7s Description: S/MIME cryptographic signature
Re: updating text in labels using ajax?
Hi Lizz, You could use an AjaxSelfUpdatingTimerBehavior to make the label (or some component containing the label) update itself and when the job is finished redirect to other page. I use a similar approach when I generate files. The result looks like: http://www.nabble.com/file/p21073112/progress.jpg I do not redirect to other page but I don't see why that should work as well.. Best, Ernesto lizz wrote: But the problem is that the user shouldnt have to press any button to update the labels... Michael Sparer wrote: Sure, use a simple Label and an AjaxButton, set setOutputMarkupId = true on the label and add it in the onSubmit method to the ajaxrequesttarget (target.addComponent(label)). But I'd also recommend taking a look at the Progressbar (search the mailinglist) - that might suits you better lizz wrote: Hi, I need to add end user information (progress information) after submit button is pressed and before being redirected to a new page. I would like to add this information by updating some labels. When the user presses the submit button 4 web services are called before I am redirecting to a new page. Since each of these calls takes a long time I would like to change the text (progress info) in a label when each web service call is finished. (So that the user sees what happends.) Is there a label with an ajax behevior that can be used? Use case: User presses the submit button web service method 1 is called when method 1 is finished i will update the text on a label component then web service method 2 is called when method 2 is finished i will update the text on the label etc etc when all web service methods are finished: setResponsePage - a new page Any idea? -- View this message in context: http://www.nabble.com/updating-text-in-labels-using-ajax--tp21072083p21073112.html Sent from the Wicket - User 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