Input Mask and Number of Characters

Hello, I have a string that needs to be filled for credit card payments. Since I want this field to be filled with numbers, I created an 8-digit input mask (like 99999999). I also want users to enter exactly 8 digits, not 3 or 7 digits. So I created a validation like this: length($Payment/CreditCard) != 8 give an validation message, otherwise continue. However, since I created an input mask, even if users enter 1 digit, the system perceives it as if 8 digits are filled. How can I solve this?    
3 answers

isMatch($Payment/CreditCard ,'\d{8}') = true worked for me.


If you use a custom validation (for the field on the page), it works for me



it should also be possible of course to do these kind of checks on change or on save.


Depending on how the page is opened, indeed it could be that validations are triggered immediately. In that case, what you could do is use validation when saving.

One would be
length($Payment/String) = 8

and the second would be 

isMatch($Payment/String, '[0,9][0,9][0,9][0,9][0,9][0,9][0,9][0,9]')


Of course this is just a simple version of the validation. you could run all validations together (similar to this example