EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on January 02, 2016, 07:37:24 PM



Title: globally removing unprintable characters [solved]
Post by: devnull 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


Title: Re: globally removing unprintable characters
Post by: jarry 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)
}
})


Title: Re: globally removing unprintable characters
Post by: devnull on January 11, 2016, 04:21:44 AM
Thamks Jarry