Page 1 of 1

I want to export this value out of the dynaform

Posted: Wed May 08, 2019 12:47 am
by marknicolai192
Hi all,

I have the grid's sum but I want to export this value out of the dynaform to the next gateway.
Is there any way to do this without add another field?.

Thanks in advance.
Mark

Re: I want to export this value out of the dynaform

Posted: Wed May 08, 2019 8:48 pm
by amosbatto
You can use PHP to calculate the grid's sum, but it is easier to use a hidden field in your Dynaform to store the grid's sum.

Create a hidden field whose ID and variable is "gridSum".
Then, add this JavaScript to your Dynaform:
Code: Select all
var formId = $("form").prop("id");
$("#"+formId).setOnSubmit( function() {
   var summed = $("#myGrid").getSummary("myFieldToSum");
   $("#gridSum").setValue(summed);
});
Where "myGrid" is the ID of your Grid and "myFieldToSum" is the ID of the grid field that is summed.

Then, in your gateway, you can use @#gridSum (as decimal number) or @%gridSum (as integer).