lagtto Posted November 5, 2014 Share Posted November 5, 2014 Hi, This is a phone mask input with 9 digit for the jQuery. UniEdit1 -> ClientEvents -> ExtEvents -> add afterrender function: function OnAfterrender(sender) { $("#"+sender.id+"-inputEl") .mask("(99) 99999-999?9") .live('focusout', function (event) { var target, phone, element; target = (event.currentTarget) ? event.currentTarget : event.srcElement; phone = target.value.replace(/\D/g, ''); element = $(target); element.unmask(); if(phone.length > 10) { element.mask("(99) 99999-999?9"); } else { element.mask("(99) 9999-9999?9"); } }); } Best regards. 1 Link to comment Share on other sites More sharing options...
mhmda Posted November 5, 2014 Share Posted November 5, 2014 1. Thank you... 2. Next time please make your code look more efficient (use code wrapper) '<>': see result function OnAfterrender(sender) { $("#"+sender.id+"-inputEl") .mask("(99) 99999-999?9") .live('focusout', function (event) { var target, phone, element; target = (event.currentTarget) ? event.currentTarget : event.srcElement; phone = target.value.replace(/\D/g, ''); element = $(target); element.unmask(); if(phone.length > 10) { element.mask("(99) 99999-999?9"); } else { element.mask("(99) 9999-9999?9"); } }); } 3. We all welcome you in our community Link to comment Share on other sites More sharing options...
SISBLU Software Posted July 17, 2019 Share Posted July 17, 2019 No function in PHONE... help-me function OnAfterrender(sender) Link to comment Share on other sites More sharing options...
Sherzod Posted July 17, 2019 Share Posted July 17, 2019 20 minutes ago, Daha Software said: No function in PHONE... help-me Hello, Have you tried to search on the forum? This post may help you: Link to comment Share on other sites More sharing options...
SISBLU Software Posted July 19, 2019 Share Posted July 19, 2019 OK, it works perfectly. But for numbers and decimals, how can I do it? Link to comment Share on other sites More sharing options...
herculanojs Posted January 18, 2020 Share Posted January 18, 2020 On 11/5/2014 at 6:55 PM, mhmda said: 1. Thank you... 2. Next time please make your code look more efficient (use code wrapper) '<>': see result function OnAfterrender(sender) { $("#"+sender.id+"-inputEl") .mask("(99) 99999-999?9") .live('focusout', function (event) { var target, phone, element; target = (event.currentTarget) ? event.currentTarget : event.srcElement; phone = target.value.replace(/\D/g, ''); element = $(target); element.unmask(); if(phone.length > 10) { element.mask("(99) 99999-999?9"); } else { element.mask("(99) 9999-9999?9"); } }); } 3. We all welcome you in our community I didn't understand how to use it. I could clarify. Link to comment Share on other sites More sharing options...
belo Posted January 18, 2020 Share Posted January 18, 2020 See this example: http://forums.unigui.com/index.php?/topic/12736-on-the-fly-mask-change/&tab=comments#comment-67805 Best Regards, Eduardo Belo Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now