EasyUI Forum
May 02, 2024, 10:29:55 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Masked Input - Paste Broken  (Read 2978 times)
bdearborn
Newbie
*
Posts: 19


View Profile
« on: February 08, 2021, 10:22:30 AM »

The Masked Input doesn't update the value when text is pasted into the input:

<input
   id="myPhone"
   name="myPhone"
   type="text"
   class="easyui-maskedbox"
   mask="999-999-9999"
   value=""
   data-options="">

Paste 123-456-7890 into the box and the underlying control value doesn't update.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: February 09, 2021, 07:35:37 AM »

Please add a 'paste' event handler to the 'maskedbox' component.
Code:
$.extend($.fn.maskedbox.defaults.inputEvents, {
paste: function(e){
var target = e.data.target;
setTimeout(function(){
var text = $(target).maskedbox('getText');
$(target).maskedbox('setValue', text);
},0)
}
})
Logged
bdearborn
Newbie
*
Posts: 19


View Profile
« Reply #2 on: February 09, 2021, 05:30:47 PM »

Thank you!
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!