|
|
Price input mask
Posted: 13 Nov 09 10:58 AM
|
How can I set up a field to accept a period in the field with numbers only. Like ###.##, were the user can enter 2 or 3.1 or 123.01 ect.? But not 3.3.2 or adg3.ws I am using version 3.1. Do I set the field to numeric only, then use the Format function to change it. But then they couldn't use the decimal point. They would have to enter 200 and I would divide by 100, to get 2 dollars. I'll keep playin with it, any help would be appreciated. Thanks Kevin |
|
|
Bev Connor
Posts: 93
|
 |
|
Re: Price input mask
Posted: 13 Nov 09 12:48 PM
|
You can use ITScriptNet's built-in functions to test for a numeric value, display an alert to the user, and format a value to a set number of decimals. In the script example below: The use of the semi-colon at the beginning of the line tells the program that the text following the semi-colon is a comment, and will turn green in the script window. Note the use of dollar signs and double quotes surrounding input element's name - the dollars signs refer to the value of the element and will turn red in the script window, whereas the double quotes only reference the element. Always check your spelling!
;test for numeric value using function IF(IsNumeric($PromptName.ElementName$)) ;value is numeric, format to 2 decimals with comma for thousands, ;and set the value back to the input element. $PromptName.ElementName$ = Format( $PromptName.ElementName$ , 2, 1) ELSE ;value is not numeric, alert the user and return to input element Buzz() Buzz() Buzz() Message("Entry must be numeric!", "ENTRY INVALID","OK","") SetFocus("PromptName.ElementName") ENDIF
|
|
|
|
|