7
There is a field in the database A1_ZTEL
he is varchar(15)
. This way each user entered record of all forms, with bar, point, comma and letter.
Now I need to ride a form and read this field from another table that is varchar(40)
and save in A1_ZTEL
(varchar 15
).
Before I show in FORM, taking only the first 15 digit and format (99)9999-9999?9
(phone or cell phone). So far, all right.
For that, I treat the bank’s return, and I do it with Replace()
and Trim()
Example:
p.ZC_CELULAR = reader["A1_ZTEL"].ToString().Trim().Substring(0,15).Replace("-","").Replace(".","").Replace(",","").Replace("/","")
This way I can take only the numbers and put in the input
with the mask.
Now I came across letters, how do I replace letters with nothing? Something like: Replace("letras","")
Thank you, so much show... it worked perfect!
– Danielle Arruda torres
I recommend that you only save numbers in the database OR mount your form to process this data, one possibility is to use a mask in the input so that it automatically does the phone Pattern:
(xx) 99999-9999
– David Dias
If you want/like jquery, I recommend this resource: https://igorescobar.github.io/jQuery-Mask-Plugin/
– David Dias
For what I saw must be Totvs , in the Configurator you set the mask in the field.
– Motta
Yes, @Daviddias , I’m dealing on the front the data entry, putting a mask of the library Jquery (99)9999-9999? 9. The problem itself was not the saving, for the saving will only number because of the mask. Loading the data (Edit), which from the database could come with characters other than number.
– Danielle Arruda torres
@Motta, we don’t use Totvs .
– Danielle Arruda torres
@Daniellearrudatorres , beauty is that Totvs uses fields with these name A!_Z....
– Motta