You can use the following JavaScript function to apply complex input masks for Short Text type questions.
Note: If you requested an account prior to January 1st, 2018 and you have created a custom template, please let us know so we can patch your template with the code required to support this.
The following is an example for creating a phone number mask.
Open your question, and on the right side of the screen, open the "Advanced settings" tab, and then scroll down to the section "Script".
Paste the following into that box:
$(document).ready(function($) {
$("#answer964548X3X15").mask("999-999-9999",{ placeholder:"###-###-####" });
});
BUT... the trick here is that you need to update the value answer964548X3X15 to reflect the right question. The structure of this code is:
answer+surveyID+QuestionGroupID+QuestionID
You can get the GroupID from the List question groups menu item at left (look for the question group
You can get the QuestionID from the List questions menu item at left
You separate the SurveyID, QuestionGroupID, and QuestionID with an "X" : answer964548X3X15
Other examples of mask usage are:
Postal code: K1A 1K1 -> mask("a9a 9a9",{ placeholder:"--- ---" })
Date: YYYY-MM-DD -> mask("9999-99-99",{ placeholder:"####-##-##" }) -- > of course, better to use the date/time field, but this lets you use Short Text if you needed not (although no data validation would occur)
Ontario Driver's License: LLLLL-FFFMY-YMMDD -> mask("aaaaa-999a9-99999",{ placeholder:" - - " })
Some pattern with wild card: AAA-999-???-AAA -> mask("aaa-999-***-aaa",{ placeholder:" - - - " })
Note in the last two examples, the placeholder contains spaces equivalent to the number of characters in each mask segment.