Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

How to check digit


Level 2

If Digit(Curency) is entered in field the value will be added. If not digit, just alphabate not added to the total field.

Text1 value = "A"

Text2 value = "$2.00"

Text3 value = "$4.70"

Total =Text2 value+Text3 value.

How to check filed value contains digit?

2 Replies


Level 10


One way of parsing a currency amount is to add a hidden decimal field, with the display patterns you need, then assign the string with currency symbol to the formattedValue.  If it matches the pattern then the rawValue will be set just as a straight number.

So try;

function parseCurrency(string)


    var result = 0;

    if (string !== null && string !== undefined)


        DecimalField1.rawValue = null;

        DecimalField1.formattedValue = string;

        if (!DecimalField1.isNull)


            result = parseFloat(DecimalField1.rawValue);



    return result;


var Total = parseCurrency(TextField1.rawValue);

Total += parseCurrency(TextField2.rawValue);

Total += parseCurrency(TextField3.rawValue);

With a display pattern of num{$zzz,zzz,zz9.88}|num{$zzzzzzzz9.88} for DecimalField1




Level 2

Hi Bruce

After a long time you are in this forum. Hope you are well. Regularly I review your post as you provide powefull and unique solution.

Thanks for your reply.