Negative currency format
Hi there!
I have a calculated field on the display form in currency format. Users want to see negative numbers in (), i.e.: -$488.64 = ($488.64)
I tried this code:
The alert shows it fine, but the field is still showing it with "-" .... Can you help please? Is there any easy solution for that? I found this js library, but i thought if i can just do it on the form it would be better.
I have a calculated field on the display form in currency format. Users want to see negative numbers in (), i.e.: -$488.64 = ($488.64)
I tried this code:
Code: Select all
function setNegEUR() {
var eurneg = fd.field('EUR_ReturnCAD').value();
if (eurneg.indexOf('-') !== -1) {
eurneg = '(' + eurneg.replace('-', '') + ')';
alert(eurneg);
}
fd.field('EUR_ReturnCAD').value(eurneg);
}
setNegEUR();
Hello Katy!
Please use the following code.
The issue was that you can't replace the field value in the display view. And the rest is working perfectly!
Please use the following code.
The issue was that you can't replace the field value in the display view. And the rest is working perfectly!
Code: Select all
function setNegEUR() {
var eurneg = fd.field('EUR_ReturnCAD').value();
if (eurneg.indexOf('-') !== -1) {
eurneg = '(' + eurneg.replace('-', '') + ')';
alert(eurneg);
}
fd.field('EUR_ReturnCAD').control()._el().text(eurneg);
}
setNegEUR();
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests