Hi,

On Thu, Nov 13, 2014 at 11:36 PM, Garret Wilson <[email protected]>
wrote:

> Hi, all. I've done a bit of searching to find the answer, and nothing
> quite seemed to fit, or was obsolete, or was deprecated, or was vague. So
> I'll ask on the list.
>
> I have a page that uses a multipart form submit. It allows the user to
> select a file, and has an AjaxSubmitLink with the label "Go" that 1)
> uploads a large file and then 2) does something that takes a long time.
> When finished, it calls info("finished!") to show a success message in the
> feedback area.
>
> So let's suppose that the user selects a file and selects "Go". After the
> file is uploaded, the processing takes place and the feedback area says
> "finished!" Perfect.
>
> Question: If the user selects /another/ file and selects "Go" /again/, how
> can I immediately remove the "finished!" message, either A) as soon as the
> user selects "Go" or B) as soon as the file finishes uploading but before
> processeing starts? (I greatly prefer option B.)
>

How is your JavaScript ?

For A)
AjaxSubmitLink(...) {
  @Override protected void updateAjaxAttributes(attrs) {
    attrs.getAjaxCallListeners().add(new
AjaxCallListener().onBeforeSend("$('#'"+feedback.getMarkupId()+").empty();"))
  }
}

For B)
I can imagine this only with WebSockets.
With HTTP 1.1 the Ajax response should be complete to be flushed to the
client by Wicket.
With WebSockets you can push data at any point of the request processing.
If you choose to use Wicket Native WebSockets then see
WebSocketRequestHandler#push(String). You can push JSON that tells the
client side WebSocket listener at the browser to do the same as the JS in A)


> Thanks,
>
> Garret
>

Reply via email to