Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
#823906
It is better to use a trigger to populate the list of options in dropdown boxes, by setting its datasource to "array variable" and setting its data variable to the name of the variable.
See: https://wiki.processmaker.com/3.2/DynaF ... Datasource

If you really need to use JavaScript, then see:
https://www.pmusers.com/index.php/Chang ... rid_fields
#823989
I don't have a mobile device to test this, but try using standard JavaScript to add the options to the dropdown in a grid.
Code: Select all
//options to add to grid dropdown:
var newOpts = [
   ["value1", "label1"],
   ["value2", "label2"],
   ["value3", "label3"]
];
var gridId = "myGrid";  //set to ID of grid
var dropdownId = "myDropdown"; //set to ID of dropdown inside grid

var nRows = $("#"+gridId).getNumberRows();

for (var i = 1; i <= nRows; i++) {
   var oDropdown = document.getElementById("form["+gridId+"]["+i+"]["+dropdownId+"]");
   
  for (var ii = 0; ii < newOpts.length; ii++) {
     var opt = document.createElement('option');
     opt.value = newOpts[ii][0];
     opt.text = newOpts[ii][1];
     oDropdown.add(opt, 0);
   }
}

$("#"+gridId).onAddRow( function(aNewRow, oGrid, rowIndex) {
  var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
  for (var ii = 0; ii < newOpts.length; ii++) {
     var opt = document.createElement('option');
     opt.value = newOpts[ii][0];
     opt.text = newOpts[ii][1];
     oDropdown.add(opt, 0);
   }
});
#823990
PS: Please don't post the same question multiple times. It makes it confusing for me and anyone searching for answers. I get to questions in my free time, so you need to be patient.
If you need answers quickly, then you should pay for a support contract with ProcessMaker Inc.
#824022
Does it work if you change onAddRow() to onShowRowDialog()?
Code: Select all
var env = PMDynaform.getEnvironment();

//if using the mobile app:
if (env == "android" || env == "iOS") {
  $("#"+gridId).onShowRowDialog( function(row, gridObject, rowIndex, rowModel) {
    var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
    for (var ii = 0; ii < newOpts.length; ii++) {
      var opt = document.createElement('option');
      opt.value = newOpts[ii][0];
      opt.text = newOpts[ii][1];
      oDropdown.add(opt, 0);
    }
  });
}
else { //if using a web browser:
  $("#"+gridId).onAddRow( function(aNewRow, oGrid, rowIndex) {
    var oDropdown = document.getElementById("form["+gridId+"]["+rowIndex+"]["+dropdownId+"]");
   
    for (var ii = 0; ii < newOpts.length; ii++) {
      var opt = document.createElement('option');
      opt.value = newOpts[ii][0];
      opt.text = newOpts[ii][1];
      oDropdown.add(opt, 0);
    }
  });
}
#824027
That's the thing, I need to fill the dropdown field on load, without tapping on the grid and waiting for a module to pop up.
.onShowRowDialog is an action that triggers a module to pop up with all the row properties.
I need to fill the dropdown when form loads.
By enesa11
#824032
takipçi al instagram ve sosyal medya almaya devam et! Kaliteli, güvenilir ve gerçek hesaplarla takip edilir. Beğendikler, yorumlar, aboneler, görüntüleme, görüntüleme hizmetleri. Youtube, twitter, facebook, instagramın tepesinde kalın.

Primero, tus comillas estan mal y olvidaste termin[…]

First of all, you are using JavaScript, not Java. […]

Stop submit from javacript

Do it this way: form = $("#637207031573dcea[…]

I can't find the database table where this informa[…]