fiorilli Posted September 5, 2018 Share Posted September 5, 2018 Hi Here in Brazil, we have two masks for phones. Phone: (99) 9999-9999 Mobile phone: (99) 99999-9999 How to enter an optional character in inputmask? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 5, 2018 Share Posted September 5, 2018 Hi, Try this mask: (99) 9999[9]-9999 Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 5, 2018 Author Share Posted September 5, 2018 Hi Delphi Developer, Thanks for replying, your mask "works". But the optional 9 must be at the beginning of the mask after (99). So it would be ideal: (99) [9]9999-9999 Pasting the mask to this format, it does not work. The equivalent in the desktop VCL would be: (99) #9999-9999 Is there any other way? Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 10, 2018 Author Share Posted September 10, 2018 up! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2018 Share Posted September 10, 2018 On 9/5/2018 at 6:15 PM, fiorilli said: But the optional 9 must be at the beginning of the mask after (99). So it would be ideal: (99) [9]9999-9999 The equivalent in the desktop VCL would be: (99) #9999-9999 Hi, It is not clear to me how you will assign a value in this case ? Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 10, 2018 Author Share Posted September 10, 2018 Hi, Sorry, what was not clear? Attached has an example of how it is on the desktop. PhoneMask.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2018 Share Posted September 10, 2018 if you will enter only manually, this should work: (99) [9]9999-9999 Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 11, 2018 Author Share Posted September 11, 2018 17 hours ago, Sherzod said: if you will enter only manually, this should work: (99) [9]9999-9999 The mask you said was the first test I did. And it did not work. Attached is the unigui example. UniPhoneMask.zip Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 13, 2018 Author Share Posted September 13, 2018 up! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2018 Share Posted September 13, 2018 1 hour ago, fiorilli said: up! Sorry, what is your exact problem, when do you enter it manually or do you assign a value programmatically? Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 13, 2018 Author Share Posted September 13, 2018 19 minutes ago, Sherzod said: Sorry, what is your exact problem, when do you enter it manually or do you assign a value programmatically? For now manually, I have not tried it programmatically yet. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2018 Share Posted September 13, 2018 You can use right arrow key for this Quote Link to comment Share on other sites More sharing options...
GerhardV Posted September 13, 2018 Share Posted September 13, 2018 Think about this for a minute...you cannot use the optional character in the front as you are filling the mask from left to right thus you will need to use the mask at the end like this: (99) 9999[9]-9999. (00) 1234_-___ And when you get to the 5th number you have to press the separator character (-) as the application does not know if you want to enter 4 or 5 numbers before the -, hence you need to indicate to the application that you only want 4 by pressing the separator (-). The application will then move the (-) one position left and let you fill in the remaining 4. Quote Link to comment Share on other sites More sharing options...
fiorilli Posted September 14, 2018 Author Share Posted September 14, 2018 21 hours ago, Sherzod said: You can use right arrow key for this Sorry, how to use the right arrow to solve the problem of removing the leftover character? 20 hours ago, GerhardV said: Think about this for a minute...you cannot use the optional character in the front as you are filling the mask from left to right thus you will need to use the mask at the end like this: (99) 9999[9]-9999. (00) 1234_-___ And when you get to the 5th number you have to press the separator character (-) as the application does not know if you want to enter 4 or 5 numbers before the -, hence you need to indicate to the application that you only want 4 by pressing the separator (-). The application will then move the (-) one position left and let you fill in the remaining 4. Why can not I use the optional character on the front? VCL Desktop allows this and other javascript plugins available on the web also allow! Apparently this is a particular case of ExtJS and InputMask.js used in UniGui. So I'm checking to see if there really is no other way before going to a third-party plugin. The optional character in the middle of the mask is a bad UX. Setting at the beginning or end of the mask, I would not have problems with UX. But in both positions does not work. Quote Link to comment Share on other sites More sharing options...
GerhardV Posted September 14, 2018 Share Posted September 14, 2018 I don't understand your argument, you have to press a space at the end to change the mask format anyway to let the application know. That isn't any different from pressing the separator (-) after you have entered 4 digits and don't want a 5th digit. Have you even tried my suggestion? Quote Link to comment Share on other sites More sharing options...
herculanojs Posted January 18, 2020 Share Posted January 18, 2020 Tente olhar isso Quote Link to comment Share on other sites More sharing options...
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.