EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jega on May 23, 2022, 12:47:48 AM



Title: [SOLVED]Form onchange fire
Post by: jega on May 23, 2022, 12:47:48 AM
Hi.

Have looked all around, and can't see anything about this.

In a form i have a textbox. When i add some text, the onChange is only fired when the textbox loose focus.

I want to enable a save button as soon the user writes some text.


Jesper


Title: Re: Form onchange fire
Post by: jarry on May 23, 2022, 07:41:19 PM
You can override the 'keydown' event handler to make the 'onChange' event triggered immediately when inputing something on the textbox component.
Code:
$.extend($.fn.textbox.defaults.inputEvents, {
keydown: function(e){
setTimeout(function(){
var t = $(e.data.target);
t.textbox('setValue', t.textbox('getText'));
},0)
}
})


Title: Re: Form onchange fire
Post by: jega on May 23, 2022, 11:24:16 PM
Thanks Jarry


Is there a reason it does not work that way from the start. Could it then be made so that it could be turned on and off in properties