Right justify and display currency


1 comment

  • Official comment
    Prajakta (Edited )

    Having the default money control format set to US currency, i.e. Dollar, limits its usage for other currencies like Euro, Pound, etc.

    For formatting a money value with commas and $ sign, you can use a Text control for that field (instead of a Money control), and then user a business rule (see this documentation) like this one to format the value entered in that Text control:

    var x, x1, x2;
    if (MoneyField.value) {
    var nStr = MoneyField.value.replace(/,/g, '');
    nStr = nStr.replace('$', '');
    nStr = parseFloat(nStr).toFixed(2);
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
    x1 = x1.replace(rgx, '$1' + ',' + '$2');
    MoneyField.value = '$' + x1 + x2;


    Note that you will have to strip the $ sign and commas from this string and convert it to a number when you want to use it for computing other values.


    To right align the currency values, you can use this custom JavaScript (see this documentation):

    // frevvo custom JavaScript
    var CustomEventHandlers = {
      setup: function (el) {
        if (CustomView.hasClass(el, 'rightalign')) {
          el.style.textAlign = 'right';

    Set the CSS class property of your control to rightalign to apply this custom JS to that control.



    Comment actions Permalink

Please sign in to leave a comment.