EasyUI Forum
May 06, 2024, 12:35:27 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED]Form onchange fire  (Read 1558 times)
jega
Full Member
***
Posts: 190


View Profile
« 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
« Last Edit: May 23, 2022, 11:24:38 PM by jega » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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)
}
})
Logged
jega
Full Member
***
Posts: 190


View Profile
« Reply #2 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!