An input mask helps users with the input by ensuring a predefined format. If you have record inserted directly to the database, you won’t be able to apply the input mask for this record. In order to validate this record, please consider creating a trigger in the database that should be triggered before inserting the record. Please find more information about triggers in the article by the link below:
Hi Matt, thanks for the info, but actually it's not what I need. I need to create a mask for each time someone adds a phone number, the + xx xx xxxxx-xxxx format is respected. The link you sent me explains how to create an error message if a value is entered into the system, assuming a mask has already been created.
You are correct, it does talk about that. But it also talks about adding the validation for the date field, which is relatively close to what you can achieve for the phone number. Moreover, adding the phone input mask is described in the community Q&A post you have included in this post.
Thanks once more. Regarding "Moreover, adding the phone input mask is described in the community Q&A post you have included in this post" you are right, but it doesn't explain it properly. I followed all steps and I got not the expected result. There is something missing in the instructions.
Looks like you did not configure it properly then. Please make sure you have the MultiMaskEdit client module in your system. Also, please check whether you have added the dependency to the correct replacing schema and the correct field. In case you have done everything accordingly and it still does not function as intended you can attach your page schema and properly describe your issue and we will take a look.
There is a pretty universal instruction for adding a field mask. It is originally meant to create a mask for a phone number, but you can adjust it as much as required.
First of all there is a control attached, which allows you to enter information using the array of masks.
To use it you need to add this module to the page dependency and to define section and include in page diff that MultiMaskEdit class and its mask have to be used.
You include onBeforePasteFormatValue method only if you want to parse input value before pasting it into control. This method is not required - control will insert only allowed values, however if you, for example, need to parse the string and insert only numeric values - for the mask above, the phone number will be inserted completely, regardless which symbols were used additionally.
The default symbols for mask input are:
{//numbers"9":{
re:"[0-9]"},
//cyryllic"к":{
re:"[а-яА-ЯёЁ]"},
//latin"l":{
re:"[a-zA-Z]"},
//any letter"c":{
re:"[а-яА-ЯёЁa-zA-Z]"},
//any letter or number"#":{
re:"[а-яА-ЯёЁA-Za-z0-9]"}}
You can choose your own symbol for mask template using maskConfig. You indicate the regular expression in re:. Also you need to indicate the symbol, that substitutes the empty values in placeHolderChar. For example you can create a mask that will allow you to enter ISBN codes where 978 are numbers and "0" is a substitute symbol.
There is an issue, though, control validation is not passed to the card model, it means that even though the control shows that the value is invalid the card will be saved.
Can you said me how import the attached file in the system?. In the "Configuration" section, under "Actions" options, I do click in "Import from file", I select the file MultiMaskEdit.js and I get a error when want load the file. I appreciated your help!