hblika
asked on
Problems with VBscript: FormatNumber
I have made a simple client-side script that does a simple calculation with two numbers. The client's PC has English OS, but is configured with Norwegian regional settings.
When I use the FormatNumber function in said script I use this syntax FormatNumber(n, 3, , , TristateUseDefault), where the TristateUseDefault parameter is supposed to use the regional settings for number formatting. This is not the case. The FormatNumber function seem to read the settings based on the language of the OS instead, which gives me problems as all numbers in the form are formatted the Norwegian way, and all other users of the application use Norwegian versions of the OS.
Anyone encountered a similar problem?
When I use the FormatNumber function in said script I use this syntax FormatNumber(n, 3, , , TristateUseDefault), where the TristateUseDefault parameter is supposed to use the regional settings for number formatting. This is not the case. The FormatNumber function seem to read the settings based on the language of the OS instead, which gives me problems as all numbers in the form are formatted the Norwegian way, and all other users of the application use Norwegian versions of the OS.
Anyone encountered a similar problem?
Include the file
<!-- #include file="adovbs.inc" -->
This contains all of the constants you will need in vbscript
Why are you using VBScript for client side validation?
<!-- #include file="adovbs.inc" -->
This contains all of the constants you will need in vbscript
Why are you using VBScript for client side validation?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Even though some of the docs say you can use the constant name in vbscript, in ASP you have to define them yourself, as green ghost says. In VB they are predefined.
I dopn't know if it will work on the client side, but this is something I have used before for server-side stuff:
http://www.webwizguide.info/asp/faq/date_time_settings.asp
http://www.webwizguide.info/asp/faq/date_time_settings.asp
Either use the value -2 instead, or set up the contant yourself:
Const TristateUseDefault=-2