surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.13k stars 804 forks source link

Input Mask Input Validation #8030

Open JaneSjs opened 6 months ago

JaneSjs commented 6 months ago

T17459 - Generate a Pattern Input Mask for Entering a Fixed Number of Digits https://surveyjs.answerdesk.io/internal/ticket/details/T17459


In the meantime, a user-entered value is cleared if it doesn't match a specified mask pattern. View Demo

Introduce an option which would notify a user that the value entered should match the specified format.


If the user input matches the mask +1 (999) 99 99 then the editor will have a value +1 (777) 88 99 and the question value will have a value 17778899 if saveMaskedValue is false and +1 (777) 88 99 value if saveMaskedValue is true.

If the user did not enter a complete value and exits the editor or the default value does not match the mask, then the value +1 (777) 88 __ will be displayed in the editor and the question value will have a value 177788 if saveMaskedValue is false and +1 (777) 88 value if saveMaskedValue is true.

https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#keepIncorrectValues

When should an error message indicate that the entered value does not match the mask? When leaving the editor, when trying to go to another page/complete a survey or a third option?

JaneSjs commented 3 months ago

+1 T18857 - Pattern input mask issues https://surveyjs.answerdesk.io/internal/ticket/details/T18857

When a value doesn't match the specified pattern, a masked field should be focused and/or a info/validation message should appear informing a user that the value entered is incomplete.