Unofficial documentation how to do interesting things and work around problems in ProcessMaker

Moderator: ArturoRobles

Forum rules: Unofficial documentation for features which have not been tested by Quality Assurance or may change in future versions of ProcessMaker
User avatar
By amosbatto
#788798
The setValue() method currently does not work to clear a datetime field.

Until this bug gets fixed, the way to clear a datetime field in ProcessMaker 3 is to use this JavaScript code:
Code: Select all
$("[id='form[datetimeID]']").val('');
$("[id='form[datetimeID_label]']").val('');
getFieldById("datetimeID").model.attributes.data.label='';
getFieldById("datetimeID").model.attributes.data.value='';
For example, a DynaForm has a datetime field with the ID of "dueDate". A button is added next to the datetime field with the ID of "clearDate". The following code is used to clear the "dueDate" field:
Code: Select all
$("#clearDate").click( function() {
   $("[id='form[dueDate]']").val('');
   $("[id='form[dueDate_label]']").val('');
   getFieldById("dueDate").model.attributes.data.label='';
   getFieldById("dueDate").model.attributes.data.value='';
})
By ekaboom
#788906
Is there a way to clear a date area inside of a grid?

I've got some caculations going on inside my grid, one of which checks to see if the start date isn't after the end date.

Since I also need the date range number, so I just added an alert if dateRange < 0

But I'd also like to clear the rangeEnd number so they have to put it in again.

Since this doesn't work
Code: Select all
      rangeEnd = '';
Is there an alternative I could use to remove the rangeEnd value inside of a grid
(I removed all the other variables to try to make it clear)
Code: Select all
$("form").setOnchange(function(field, newVal, oldVal) {
  var totalRows = $("#grid0001").getNumberRows();
  for (var i = 1; i <= totalRows; i++) {
    rangeStart = moment($("#grid0001").getValue(i, 1));
    rangeEnd = moment($("#grid0001").getValue(i, 2));
    dateRange = rangeEnd.diff(rangeStart, 'days');

    //make sure the user entered valid values:
    if (dateRange < 0) { 
      rangeEnd = '';
      alert('Start Date Is Before End Date.  Change The End Date/Start Date');
    }
    $("#grid0001").setValue(dateRange, i, 21);
  }
});
User avatar
By amosbatto
#788910
This bug is going to get fixed in the upcoming version 3.2, but if you want to clear the value in a datetime in a grid, then you need to do it this way:
Code: Select all
$("[id='[gridID][row-number][datetimeID]']").find("input").val('')
For example, in a grid with the ID 'clientsList' and a Datetime with the ID "dueDate", you can clear this datetime in the second row this way:
Code: Select all
$("[id='[clientsList][2][dueDate]']").find("input").val('')
User avatar
By amosbatto
#794542
This bug has been fixed in PM 3.2 and later. Now it is possible to clear at datetime field with this JavaScript:
Code: Select all
$("#mydatetime").setValue(""); 
where "mydatetime" is the ID of the datetime field.
By markjustin
#794721
Thanks for giving such detailed information. I am really very comfused regarding this topic but my all confusions resolved. Please keep doing.
By Frankyv12
#826620
ekaboom wrote: Thu Feb 02, 2017 11:50 am Is there a way to clear a date area inside of a grid?

I've got some caculations going on inside my grid, one of which checks to see if the start date isn't after the end date.

Since I also need the date range number Rachat crédit piscine, so I just added an alert if dateRange < 0

But I'd also like to clear the rangeEnd number so they have to put it in again.

Since this doesn't work
Code: Select all
      rangeEnd = '';
Is there an alternative I could use to remove the rangeEnd value inside of a grid
(I removed all the other variables to try to make it clear)
Code: Select all
$("form").setOnchange(function(field, newVal, oldVal) {
  var totalRows = $("#grid0001").getNumberRows();
  for (var i = 1; i <= totalRows; i++) {
    rangeStart = moment($("#grid0001").getValue(i, 1));
    rangeEnd = moment($("#grid0001").getValue(i, 2));
    dateRange = rangeEnd.diff(rangeStart, 'days');

    //make sure the user entered valid values:
    if (dateRange < 0) { 
      rangeEnd = '';
      alert('Start Date Is Before End Date.  Change The End Date/Start Date');
    }
    $("#grid0001").setValue(dateRange, i, 21);
  }
});
It's been a long time since I'm looking for these codes. Thank you for yours
By liaarachma
#829029
amosbatto wrote: Thu Feb 02, 2017 4:45 pm This bug is going to get fixed in the upcoming version 3.2, but if you want to clear the value in a datetime in a grid, then you need to do it this way:
Code: Select all
$("[id='[gridID][row-number][datetimeID]']").find("input").val('')
For example, in a grid with the ID 'clientsList' and a Datetime with the ID "dueDate", you can clear this datetime in the second row this way:
Code: Select all
$("[id='[clientsList][2][dueDate]']").find("input").val('')
What if I have an array in my grid? Becuase when I change [row-number]with (i) it is not work. This is my code:

function cekMasuk(newVal){
console.log("halo");
var aGridVals = $('#personel_off').getValue();
for (var i = 1; i <= aGridVals.length; i++) {
var masuk_kembali = $("#personel_off").getValue(i, 13);
if(masuk_kembali == "a"){
$("#personel_off").getControl(i, 14).attr("disabled", false);
$("#personel_off").getControl(i, 15).attr("disabled", false);

}else{
$("#personel_off").getControl(i, 14).attr("disabled", true);
$("#personel_off").getControl(i, 15).attr("disabled", true);
$("#personel_off").setValue("-", i, 14);
$("[id='[personel_off][0][tgl_masuk]']").find("input").val('');
}
}
}

I've exported and imported a process copy, when st[…]

Hi Kirk, Thx for your advice. I was thinking of […]

Number of columns of a grid

Hi, Accidentally, in https://www.pmusers.com/inde[…]

Was wondering if anyone has encountered issues run[…]