18. Working with Data Types and Data Display Formats : String Input Templates : String Template Creation : How to Specify a Default Character
 
Share this page                  
How to Specify a Default Character
To specify a default character for a position, include the following syntax in your character set definition:
//c
The c is the default character. For example, assume that you want the user to enter a 4‑digit number. They must enter at least two numbers, but if they fail to enter the final two numbers, you want the number 1 in each of those positions. Your template looks like this:
nn[#//1][#//1]
The n forces entry of a digit in those positions. The other two positions allow entry of a digit, but insert the specified default if the user does not make an entry.
When you specify a default character for a position, with one exception, the default character is inserted whenever the user inserts a space in that position or fails to make an entry into that position. The exception occurs when the space is a valid entry for that position. In such instances, the space is placed in the position. If a space is not a valid entry, the default character is placed in the position.
The specified default character is always considered to be a valid character for the position, even if it is not part of the character set defined for that position by the template.