Form Properties: Format
Format Properties are available for Text Boxes and Dropdowns. It enables default and custom format rendering and validation. It is extremely useful to ensure that numbers, dates, times, and various other formats are entered correctly 100% of the time. There are a variety of Format categories, which are described below.
This is the default setting; no format is specified.
A Number format allows Revu to quickly parse input text and formats the output text in a specific manner. When selected, the following options become available:
- Decimal Places: The Decimal Places property determines how many numbers after the period (“.”) are acceptable in a numerical value. For example, setting the Decimal Places to "0" and for an entered value of “12.345678” will show “12” in the field. Setting the Decimal Places to 3 results in “12.345” being shown in the field.
- Separator Style: The separator styles are used to group the number for better legibility. Several examples are described below.
- 1,234.56: Entered text “123456789.0123” appears as “123,456,789.0123”.
- 1234.56: Entered text “123456789.0123” appears as “123456789.0123”.
- 1.234,56: Entered text “123456789.0123” appears as “123.456.789,0123”.
- 1234,56: Entered text “123456789.0123” appears as “123456789,0123”.
- 1’234.56: Entered text “123456789.0123” appears as “123’456’789.0123”.
- Currency Symbol: Selects the currency symbol to display, indicating that the number represents a monetary value. For example, if entering the value 123.45 using the currency symbol for the US dollar, then the text box would show $123.45.
- Symbol Location: This property specifies the symbol that should appear before or after the rendered input value. There are four options: 1) Before with Space, 2) Before No Space, 3) After With Space, and 4) After No Space.
- Negative Style: There are two ways to display the negative values: 1) Parenthesis, or 2) Red Text. Many accounting applications show negative values by wrapping a positive number around parenthesis, and others show the negative values in red text.
A Percentage format allows Revu to quickly parse input text for numbers between 0 and 1 then render the output text as a percentage. When selected, the following options become available:
- Decimal Places: This property behaves the same way as the Decimal Places property for a Number.
- Separator Style: This property behaves the same way as the Separator Style property for a Number.
Use the date format to enter, parse, and validate dates. When selected, the following options become available:
Built-in Date Options: There are 25 built-in date options. The following table describes the formatting options for the date:
Format Token |
Semantics |
m |
The month number from 1 to 9 |
mm |
The month number from 01 to 12 |
mmm |
The abbreviated month (for example: "Jan") |
mmmm |
The full month (for example: "January") |
d |
The day number from 1 to 9 |
dd |
The day number from 1 to 31 |
ddd |
The abbreviated day of the week (for example: "Fri") |
dddd |
The full day of the week (for example: "Friday") |
yy |
The year (00 is short for 2000) |
yyyy |
The full year |
HH |
Hours in 24-hour format |
hh |
Hours in 12-hour format |
MM |
Minutes |
ss |
Seconds |
tt |
AM or PM |
Custom Date Option: If an alternative format is required, a custom date option may be defined. A custom formatting string may be defined using the above table to format the date appearance. For example, ss:MM:HH:dd:mm:yyyy
would format the entry 00:31:15:11:02:2011 to be shown as 2/11/2011 3:31 PM.
Time: Similar to Date format but designed for time stamps.
- Built-in Time Options: There are four common time options built in.
- Custom Time Option: A custom time option may be formatted similar to the formatting of the date fields.
There are a few special format types. The format types are described in further detail.
- Zip Code: Ultimately, this matches the regular expression
\d{0,5}
. Numbers such as 91101 would be identified as valid zip codes. - Zip Code + 4: This matches the regular expression
\d{0,5}(\.|[- ])?\d{0,4}
. Numbers such as 91101-0123 would be identified as valid zip codes.
- Phone Number: This matches one of the following regular expressions:
\d{0,3}(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\(\d{0,3}
\(\d{0,3}\)(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\(\d{0,3}(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\d{0,3}\)(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
011(\.|[- \d])*
Phone numbers such as 888-888-8888 or (888) 888-8888 would be identified as a valid phone numbers.
- Social Security Number: This matches the following regular expression
\d{0,3}(\.|[- ])?\d{0,2}(\.|[- ])?\d{0,4}
. A social security number such as 000-00-0000 would be identified as a valid social security number.
The custom format category is used if none of the built-in formats meet the requirements. Examples applications for a custom field would be for email addresses or Bates Numbers.
- Custom Format Script: Custom JavaScript may be run to validate user input in this field. Below is an example to validate that only numbers will be entered into a Text Box.
// add this to the Global JavaScripts
String.prototype.isNumber = function() {
var data = this.valueOf();
if (data.match(/^[0-9]+$/)) {
returntrue;
}
returnfalse;
};
OnCustomFormatEvent = function(event) {
var field = this.getField("Text1");
var data = new String(field.value);
if (data.isNumber()) {
event.value = "Number Identified";
}
else {
event.value = "Number Not Identified";
}
};
// add this to the Custom Format Script for your Text Box named Text1
OnCustomFormatEvent(event);
Upon invoking custom format script, the event.value is read back from the event object.Other properties, for example event.rc, are ignored.
- Custom Keystroke Script: Use this field to specify a Custom Keystroke Script to run a script on each keystroke as it is entered by a user. The following example checks to see that the numbers entered are between 1 and 100.
var data = new Number(event.value);
if (1 <= data && data <= 100) {
event.rc = false;
}
else {
event.rc = true;
}