Getting Started

Validating and formatting data

You can change the properties of Formatted Text parts so that they automatically validate the data that the user enters and format the data for display. To do this, you modify the format property associated with the Formatted Text part.

Using the Formatted Text part's Social Security data type

To have the data in the Enter SSN field appear in the format of a standard U.S. social security number, you must change the format type of the Formatted Text part to Social Security Number.

  1. Open the SSN Formatted Text part's properties window.
  2. Select the Value field for the format property then select Open dialog icon to open the Formats dialog. From the Data type drop-down list, select String. This indicates that the type of data is string.
  3. Now, to set the particular format for the string data, select the Value field for the formatString property then select Open dialog icon to open the Format string dialog. From the Predefined formats , select Social security number (U.S.) and then select OK to close the Format string window, select OK to close the Formats dialog.
  4. To test how the formatted text will display, select Test tool from the tool bar.

Using the Formatted Text part's Monetary data type

To have the data in the Price per share field appear as currency, you must change the data type of the Formatted Text part to Monetary Amount.

  1. Double-click on the Price per share Formatted Text part to open the Properties window for the part.
  2. Select the Value field for the format property then select Open dialog icon to open the Formats dialog. From the Data type drop-down list, select Monetary. This indicates that the type of data is monetary.
  3. For our purposes, we'll accept the default values for the monetary type format. Select OK to close the Formats dialog.
  4. To test how the formatted text will display, select Test tool from the tool bar.

For more information on validating and formatting data, see the VisualAge Smalltalk User's Guide .


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]