I am looking for examples of how to display a number as currency in a text field. Everything I have tried does not work. This program has everything but this function.
Like this:
Price $: 1,000
I was able to display the text and the value, but can't figure out how to do the formatting to show the value of "Editbox3"(my test number field) as currency.
"Price: $" + [Editbox3].toString()
Am I missing something that is built-in? Any help would be great.
John
convert numbers to a string and currency
- BaconFries
-
- Posts: 5914
- Joined: Thu Aug 16, 2007 7:32 pm
Re: convert numbers to a string and currency
Have you read from the following:
Conditions
Conditions
Re: convert numbers to a string and currency
This is not specific to this program. You will need to implement this with JavaScript.This program has everything but this function.
Just like Bacon Fries suggested you can try to use conditions..
http://www.wysiwygwebbuilder.com/suppor ... ions4.html
Re: convert numbers to a string and currency
Thanks for the reply. I already have the symbol and the number. The problem with the format is that it shows it as a decimal and not currency.
This is what I have now:
Price: $ 1134.00
What I would like to see is this:
Price: $ 1,334.00
How would conditions change a decimal point to a comma? Pablo, your example does not show a number large enough to example this. I totally understand that the program does not do this, but it seems logical that a form may require this format and that it maybe the program should be able to do it.
Thanks again,
John
This is what I have now:
Price: $ 1134.00
What I would like to see is this:
Price: $ 1,334.00
How would conditions change a decimal point to a comma? Pablo, your example does not show a number large enough to example this. I totally understand that the program does not do this, but it seems logical that a form may require this format and that it maybe the program should be able to do it.
Thanks again,
John
Re: convert numbers to a string and currency

<script>
function myFunction() {
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
});
// Use it.
var amount = document.getElementById("Editbox3").value;
document.getElementById("Editbox7").value = formatter.format(amount);
var amount2 = document.getElementById("baseprice").value;
document.getElementById("baseprice_str").value = formatter.format(amount2);
}
</script>