EasyUI Forum
September 16, 2025, 01:00:46 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: globally removing unprintable characters [solved]  (Read 6542 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: January 02, 2016, 07:37:24 PM »

Hi;

I am facing a lot of problems where users are copying data from microsoft word and pasting into the inputs.

Is there any way of globally removing unprintable characters from any input without having to write an onChange event for each individual input ?

Thanks
« Last Edit: January 11, 2016, 04:22:06 AM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: January 03, 2016, 09:20:35 AM »

If you are using the 'textbox' component, you can bind the 'paste' event to the input box. Reset the inputed characters after pasting to the input box.
Code:
$.extend($.fn.textbox.defaults.inputEvents, {
paste: function(e){
var t = $(e.data.target);
setTimeout(function(){
var v = t.textbox('getText');
v = ... // modify it
t.textbox('setText', v);
},0)
}
})
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: January 11, 2016, 04:21:44 AM »

Thamks Jarry
Logged

-- Licensed User --
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!