French dollar amount text field entry, enter Keystroke period or comma, becomes comma in JavaScript
French dollar amount text field entry, enter Keystroke period or comma, becomes comma in text field.
Currently my scripts do this:
If I type 12345, it converts to 12345,00 not 123,45
If I type 123,45, it remains 123,45, which is fine for French.
If I type 123.45, the period is unavailable. I must use the comma otherwise the amount would show as: 12345,00 instead of 123,45, it will automatically add zero cents.
I have 2 functions to a document level JavaScripts for the French dollar amounts.
FORMAT SCRIPT
function fr_format_decimal() {
AFNumber_Format(2, 2, 0, 0, "", false);
event.value = event.value.replace(/\./g, " ");
}
KEYSTROKE SCRIPT
function fr_keystroke_decimal() {
AFNumber_Keystroke(2, 2, 0, 0, "", false);
}
TEXT FIELD PROPERTIES / FORMAT / CUSTOM
Custom Format Script
// Custom Format JavaScript
fr_format_decimal();
Custom Keystroke Script
// Custom Keystroke JavaScript
fr_keystroke_decimal();
I need to be able to type a "comma" or "period" and have it end up French (Comma).
1234.50 or 1234,50 = 1234,50
I am not very good with scripts, any help I can get to make this work would be greatly appreciated.
Many Thanks.
