Hi Serban,
This problem happens because after typing something in the text field
you click with the mouse on the button. This way the browser first
fires 'click' event for the button and then 'blur' event for the text
field.
DROP doesn't help because this is part of its design. The first Ajax
request fires and then all following requests in the same channel
should wait. With type QUEUE all scheduled requests are executed one
by one. With DROP - only the last one of the scheduled ones, i.e. only
the first and the last are executed, all in the middle are dropped. In
Wicket 6 there is a new type - ACTIVE, this one drops all requests if
there is currently running request in this channel. It would help you
only if you are 100% certain that 'blur' wont happen right before
'click'.
How to solve it? I see a workaround with AjaxCallDecorator - wrap the
script for the button in setTimeout() with some small value for the
delay. This way it will "wait" for 'blur' to be processed.
On Mon, Aug 6, 2012 at 2:11 PM, Serban.Balamaci wrote:
> Hi guys, I'm asking for an opinion on how to approach the following:
>
> Wicket 1.5.7, browser Chrome, Firefox.
>
> I have a FormTestPanel with
> TextField and AjaxFormComponentUpdatingBehavior attached:
>
> AjaxFormComponentUpdatingBehavior formUpdate = new
> AjaxFormComponentUpdatingBehavior("onblur") {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> //do nothing just want to update the textfield model on
> leaving it
> }
>
> The Form also has an AjaxButton:
> AjaxButton btnSend = new AjaxButton("sendMessage") {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form form)
> {
> //replace through ajax FormTestPanel with Empty panel
> let's say
> }
>}
>
>
> My view on this was that the flow would be to queue events in this order:
> Blur
> Submit
>
> somehow it gets to
> Submit
> Blur
>
> This causes a ComponentNotFoundException: Could not find component
> 'content-panel:form:textMessage'.
>
> Shouldn't page versioning "help" with ComponentNotFound in this case? Sure
> the component hierarchy changed after the form submit but that blur event
> should have the older version of the page which had a different component
> hierarchy?
>
> I tried putting a Channel "0" type Drop on both behavior and AjaxButton:
> @Override
> protected AjaxChannel getChannel() {
> return new AjaxChannel("0", AjaxChannel.Type.DROP);
> }
> but it doesn't seem to cancel any of them, anyway I wouldn't have expected
> this to work as it would have probably canceled the submit button event but
> it was reminiscent of the times when I thought the blur event gets triggered
> twice.
>
>
> My current solution was so far to setResponsePage which I think might work
> as it will clearly target another version but I didn't want to have to give
> up on the SinglePage setup.
>
> Any other idea how I can handle this?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/ComponentNotFound-exception-question-tp4651013.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
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org