Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#822696
you have a dynaform with a grid, in which a column is configured to perform the auto addition. you want to obtain the value of the sum and assign it to a text field to later perform operations with this value
the code to perform these actions on web works perfectly, my problem is that mobile does not rescue the value of the sum.
example of my code:
Code: Select all
"$ (" # GD_SERVICIOS "). Change (function () {
  var rows = $ ("#GD_SERVICIOS"). getNumberRows ();
  var sum = 0;
  for (var i = 1; i <= rows; i ++) {
    var price = $ ("# GD_SERVICIOS"). getValue (i, 5);
      if (price! = '') {
        price = $ ("# GD_SERVICIOS"). getValue (i, 5);
        sum = price + sum;
      }
  }
  var sum_real = sum;
  $ ("# TXT_TOTAL_SERV"). SetValue (sum_real);
  var t1 = $ ("# TXT_TOTAL_SERV"). getValue ();
  var t2 = $ ("# TXT_TOTAL_ART"). getValue ();
console.log ("value t1:" + t1);
console.log ("value t1:" + t2);
total var = t1 + t2;
console.log ("total value:" + total);
var total_final = "$" + total;
console.log ("total_final value:" + total_final);
$ ("# TXT_TOTAL_FINAL"). SetValue (total_final);
 }); "
#822709
Try it this way:
Code: Select all
var formId = $("form").prop("id");

$("#"+formId).setOnchange( function(fieldId, newVal, oldVal) {
  if (fieldId.search(/^\[GD_SERVICIOS\]/) == 0) {
    var rows = $("#GD_SERVICIOS").getNumberRows();
    var sum = 0;
    for (var i = 1; i <= rows; i ++) {
      var price = parseFloat( $("#GD_SERVICIOS").getValue (i, 5) );
      if (price! = '') {
        price = parseFloat( $("#GD_SERVICIOS").getValue (i, 5) );
        sum = price + sum;
      }
    }
  }
  var sum_real = sum;
  $("#TXT_TOTAL_SERV").setValue(sum_real);

  var t1 = parseFloat( $("# TXT_TOTAL_SERV").getValue() );
  var t2 = parseFloat( $("# TXT_TOTAL_ART").getValue() );
  console.log ("value t1:" + t1);
  console.log ("value t1:" + t2);
  total var = t1 + t2;
  console.log("total value:" + total);
  var total_final = "$" + total;
  console.log ("total_final value:" + total_final);
  $("#TXT_TOTAL_FINAL").setValue(total_final);
});
See: https://wiki.processmaker.com/3.1/Grid_ ... s_in_grids
Several times you capitalized functions which shouldn't be capitalized. Remember that JavaScript is case sensitive.
[/code]

🚀 Kaçırmayın! Dinamik kripto endüstris[…]

Are you thinking of joining the exciting world of […]

I started betting on sports at https://ggbet.co.uk[…]

As an NFT enthusiast looking to develop your own N[…]