lagtto Posted November 5, 2014 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 Quote
mhmda Posted November 5, 2014 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 Quote
SISBLU Software Posted July 17, 2019 Posted July 17, 2019 No function in PHONE... help-me function OnAfterrender(sender) Quote
Sherzod Posted July 17, 2019 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: Quote
SISBLU Software Posted July 19, 2019 Posted July 19, 2019 OK, it works perfectly. But for numbers and decimals, how can I do it? Quote
herculanojs Posted January 18, 2020 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. Quote
belo Posted January 18, 2020 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.