Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#824928
I am trying to total all the values from a column in a grid and storing it in a textbox for further utilization.

However, no change happens to the value of the textbox when I try to set value using setValue.

This is the code I am using (gridID - equipments, textbox ID - hls40quant)
Code: Select all
$("#equipments").setOnchange(function(field, newVal, oldVal){
  var totalRows = $("#equipments").getNumberRows();
  var total = 0;
  for (var count = 0; i < totalRows; i++)
  {
    total = total + $("#equipments").getValue(i,2);
  }
  $("#hls40quant").setValue(total);
});
#824961
try it this way:
Code: Select all
$("#equipments").setOnchange(function(field, newVal, oldVal){
  var totalRows = $("#equipments").getNumberRows();
  var total = 0;

  for (var count = 1; i <= totalRows; i++) {
    var amount = parseFloat( $("#equipments").getValue(i,2) );
    amount = isNaN(amount) ? 0.0 : amount;
    total += amount;
  }

  $("#hls40quant").setValue(total);
});
If the value is an integer, use parseInt().
There are a number of grid examples that might help you at https://www.pmusers.com

In the rapidly evolving world of online sports be[…]

STEPN integrates social networking and games that […]

Cenforce 150 is a medication used to cope with a c[…]

What's SAP FICO?

Trustworthy and skill-building, each of these actu[…]