How do I restrict or format user input on a datafield?


Problem

There are times when a particular data field requires a specific entry format. Instead of reading in the user's entry, validating this entry and then displaying an error when the entry does not follow the necessary format, it would be easier to retrict the user's input as it is entered. This will restrict the user's input and guarentee the expected format is entered.

Solution

The XmNpicture resource allows you to format values entered into a datafield. An example would be the US Phone Number picture: (###)###-###. The picture is used to convert characters entered into the field to a formatted value.

The table below shows the characters you can use in a picture and how the DataField widget interprets them.


BACK HOME Send Email