Skip to Content
avatar image
Former Member

Subtotals format in Adobe forms when using javascript

Hi,

I am calculating subtotals in adobe forms using java script and I am using numeric field to display.

Script code:

var qtotal = 0;

for (var j=0; j <= xfa.layout.page(this)-1; j++){

var fields = xfa.layout.pageContent(j, "field", 0); 

//xfa.host.messageBox(xfa.layout.page(j).toString());

for (var i=0; i <= fields.length-1; i++){

if (fields.item(i).name == "VALUE"){

qtotal = qtotal + fields.item(i).rawValue;

}

}

}

  1. this.rawValue = qtotal;

I am getting the output as 680,000 but I need it as  6.800,00 .

I tried using patterns but it’s not working.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 30, 2014 at 08:55 AM

    Hi, Saiyog!

    Is display field of numeric or decimal type? Try to change it to decimal.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I would try to bind the calculated value to a decimal field without any patterns. If it wouldn't help - then it's time for testing 😊

      Some options for you to check and test:

      1) check the value in qtotal (e.g. show it in a messagebox)

      2) try to bind qtotal to any other decimal field - maybe it's just a "bad" field and you just need to recreate it. I've seen an unexplainable behaviour of fields a couple of times.

      3) and - by the way - does the field has enough width for the calculated value? If the value would overlap the cell you can get format surprises from the field.

      If it still wouldn't help, then I'd like to have a look at the form.