java - Event triggered when the content in textarea is deleted -
i have wicket application , need save data via ajax when content in textarea changes. can via "onchange" dom event when content changes. when user deletes (by backspace or delete keys) entire content onchange event doesn't triggered. event gets triggered ?
i tried oninput, onkeyup , onchange. these work until there's @ least 1 character left.
wicket specific info: version 1.5. text area added on panel , added on defaultdatatable. component not directly added form. textarea wired propertymodel
final textarea commentsta = new textarea("commentsta", new propertymodel<string>(dataobject, "property1")); commentsta.setoutputmarkupid(true); commentsta.setrequired(true); commentsta.setoutputmarkupplaceholdertag(true); commentsta.add(new ajaxformcomponentupdatingbehavior("onchange") { @override protected void onupdate(ajaxrequesttarget target) { system.out.print("starting onchange.... "); system.out.print("onchange: " + commentsta.getconvertedinput()); } });
updates: removed commentsta.setrequired(true);
above code , started working. guess reason wicket enforces validation , result of onchange event fired.
Comments
Post a Comment