Questions and discussion about using ProcessMaker: user interface, running cases & functionality
User avatar
By amosbatto
#826514
You can use grid.removeRow().

If you want to remove blank rows when submitting the Dynaform, add this JavaScript code to your Dynaform:
Code: Select all
//set to the column number of the grid field to check if blank; counting starts counting from 0:
var colNoCheckIfBlank = 3; 
var formId = $("form").prop("id");

$("#"+formId).setOnSubmit( function() {
  var oGrid = $("#myGrid"); //change "myGrid" to the grid's ID
  var aGridVals = oGrid.getValue();
  var aRowsToDelete = [];

  for (i = aGridVals.length; i > 0; i--) {
     //subtract 1 because array counts from 0, not from 1
     if (aGridVals[i-1][colNoCheckIfBlank] == "") {
        oGrid.deleteRow(i);
     }
  }
});           
By Iykedigit
#827840
Hi. I've a grid that is populated when I select the desired number of rows I want from a drop down. However, when the forum moves to the next task, the data in the last row in the grid is cleared. So if for instance, I select that I want 3 rows, when I proceed to the next task the third row is empty. Plz help. See code below.

function gridsome(){
//get the no of accounts required
var accountNumber = $("#no_of_accounts").getValue();
var accountNumber = accountNumber + 1;
var gridRow = $("#accountDetailsGrid").getNumberRows() + 1;
if (accountNumber > gridRow){
for (var i = gridRow; i < accountNumber; i++){

$("#accountDetailsGrid").addRow();
}
}else{

for (var i = gridRow; i > accountNumber; i--){
$("#accountDetailsGrid").deleteRow();
}
}
}


$("#no_of_accounts").setOnchange(gridsome);
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]