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

Moderator: amosbatto

Forum rules: Unofficial documentation for features which have not been tested by Quality Assurance or may change in future versions of ProcessMaker
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);
  }
});
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('')
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.

Hello everyone, A couple days ago I tried to displ[…]

Hello, i have next problem When you submit a for[…]

Unfortunately, the Dev team decided that allowin[…]

Hello everyone in previous versions of PM the ca[…]