Take a look at IndicatingAjaxButton in the extensions-project and adapt it for your form. If you don't mind taking the default indicator, you can use WicketAjaxIndicatorAppender just like in the mentioned class
Martin Makundi wrote: > > Hi! > > Can anyone help? I am having difficulties showing a bysy indicator > besides the submit button, while the form is being submitted and > processed. I have only found pieces of varying examples and I have > tried to put them work together, but it just does not seem want to > show the indicator. Here is my code: > > public class Login extends WebPage { > // ... default constructor contents: > final Form loginForm = new Form(LOGIN_FORM, new Model()); > final AjaxIndicatorContainer indicatorContainer = new > AjaxIndicatorContainer(); > indicatorContainer.setOutputMarkupId(true); > loginForm.add(indicatorContainer); > final SubmitLink loginButton = new SubmitLink(LOGIN_BUTTON, new > Model()) { > /** > * @see org.apache.wicket.markup.html.form.SubmitLink#onSubmit() > */ > @Override > public void onSubmit() { > super.onSubmit(); > Thread.sleep(5000); // Simulate form processing > } > }; > abstract class AjaxFormSubmitIndicator extends > AjaxFormSubmitBehavior implements IAjaxIndicatorAware { > /** > * Constructor for TODO > * > */ > public AjaxFormSubmitIndicator() { > super("onchange"); // I have tried "onchange" and "onclick" > } > } > loginButton.add(new AjaxFormSubmitIndicator() { > @Override > protected void onError(AjaxRequestTarget arg0) { > // TODO Auto-generated method stub > } > > @Override > protected void onSubmit(AjaxRequestTarget arg0) { > loginButton.onSubmit(); > } > > public String getAjaxIndicatorMarkupId() { > return indicatorContainer.getMarkupId(); > } > }); > loginForm.add(loginButton); > > // ... etc.. > > add(new FeedbackPanel("feedback")); > add(loginForm); > } > > > > > public class AjaxIndicatorContainer extends WebMarkupContainer { > /** > * > */ > private static final long serialVersionUID = 5573778050703849297L; > /** > * > */ > public static final String INDICATOR_MARKUP_ID = "ajaxIndicator"; > > /** > * Constructor for TODO > */ > public AjaxIndicatorContainer() { > super(INDICATOR_MARKUP_ID); > } > > /** > * @see > org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag) > */ > @Override > protected void onComponentTag(ComponentTag tag) { > super.onComponentTag(tag); > tag.put("src",urlFor(AbstractDefaultAjaxBehavior.INDICATOR)); > } > > > > > <body> > <wicket:extend> > <h1>Login</h1> > Feedback messages will be here. > <form wicket:id="loginForm"> > <table border="0" cellspacing="0" cellpadding="2" align="center"> > <tr><td NOWRAP width="80" align="right"> > Username: > </td> > <td><input type="text" wicket:id="userId"></td></tr> > <tr><td NOWRAP align="right"> > Password: </td><td><input type="password" wicket:id="password"></td></tr> > <tr><td align="right"> # </td><td NOWRAP> > <input type="submit" value="Sign in" wicket:id="loginButton"> > </td></tr> > </table> > </form> > </wicket:extend> > </body> > > > ** > Martin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > ----- Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Ajax-Busy-Indicator-tp15153150p15160382.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]