# How Do I Format a Value Based on a Given Format?

If you need to format a value based on a given format, for example, on Person ID Number, if you select ID Type as SSN (999-99-9999), you can always format the Person ID Number before committing it to the server.

To do so, you can call the `formatValue` javascript function.

- In the user exit file of the tab page include the following lines:

      					</SCRIPT>
      					<SCRIPT src="/zz/formatValue/formatValue.js"></SCRIPT>
      					<SCRIPT>

- Now, you can start using the function to format a value. To use this function, you need to pass in both the value and the format into the function.

      					var phFormat = myData.getValue(pureListName + 'PHONE_TYPE_FORMAT');
      					if (pureFieldName == 'PHONE') {
      					  updateField(pureListName + 'PHONE' ,
      					        formatValue(myData.getValue(pureListName + 'PHONE'), phFormat));
      					}

Parent topic: How-To