You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2020/12/15 13:20:00 UTC

[jira] [Resolved] (WICKET-6854) OnChangeAjaxBehaviour is not called if the last character gets removed.

     [ https://issues.apache.org/jira/browse/WICKET-6854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov resolved WICKET-6854.
-----------------------------------------------
      Assignee: Martin Tzvetanov Grigorov
    Resolution: Cannot Reproduce

Closing as "Cannot Reproduce".

The behavior works just fine for me with latest 9.0.x.

Tested it with wicket-examples module:

 
{code:java}
diff --git wicket-examples/src/main/java/org/apache/wicket/examples/echo/Echo.java wicket-examples/src/main/java/org/apache/wicket/examples/echo/Echo.java
index bdb837c7cc..09a150d8b0 100644
--- wicket-examples/src/main/java/org/apache/wicket/examples/echo/Echo.java
+++ wicket-examples/src/main/java/org/apache/wicket/examples/echo/Echo.java
@@ -16,6 +16,8 @@
  */
 package org.apache.wicket.examples.echo;
 
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
 import org.apache.wicket.examples.WicketExamplePage;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
@@ -48,7 +50,12 @@ public class Echo extends WicketExamplePage
                // else with this form as the shared model is automatically updated
                // on form submits
                Form<?> form = new Form("form");
-               form.add(new TextField<>("msgInput", messageModel));
+               form.add(new TextField<>("msgInput", messageModel).add(new OnChangeAjaxBehavior() {
+                       @Override
+                       protected void onUpdate(final AjaxRequestTarget target) {
+                               System.err.println("=== CHANGED : " + getFormComponent().getModelObject());
+                       }
+               }));
                add(form);
 {code}
 

Tested it with Firefox 83 and Google Chrome 81. Both Backspace and Delete fire Ajax events.

 

Please provide more information and a demo application and we will reopen the ticket.

> OnChangeAjaxBehaviour is not called if the last character gets removed.
> -----------------------------------------------------------------------
>
>                 Key: WICKET-6854
>                 URL: https://issues.apache.org/jira/browse/WICKET-6854
>             Project: Wicket
>          Issue Type: Bug
>            Reporter: Stefan Franke
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>
> Consider this code where a TextField gets a OnChangeAjaxBehaviour 
> {code:java}
> // 
> TextField<String> tf = new TextField<>("id", model);
> tf.add(new OnChangeAjaxBehaviour() {
>   public void onUpdate(AjaxRequestTarget target) {
>     LOG.debug("update");
>   }
> }
> form.add(tf){code}
> entering and modifying text into the TextField is working.
> deleting mostly works too, but not for the last character. It does'nt matter if you use [DEL] or [BS]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)