Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: ArturoRobles

By cosyxu
Good morning,

I am currently using datetime control to let a user to input a DD/MM/YYYY,HH:mm format datetime, however I was wondering is it possible to set the mm to either 0 and 30 mintues?

For example: a user can only select either 10:00 or 10:30.

Thank you,
User avatar
By amosbatto
You can create a "change" event handler with control.setOnchange() to reset the minutes to 0 or 30 after the user changes the time. However, I discovered that you can't call setValue() inside the event handler, because it will cause the web browser to enter an infinite loop and freeze up.

The trick is to use window.setInterval() to set a timer to execute code that will change the time a second later after the user changes the value. Then call window.callInterval() to remove the timer.

Here is the JavaScript you can use:
Code: Select all
var appointmentTimer = null;

$("#appointmentTime").setOnchange(function(newTime, oldTime) {
  var oTime = moment(newTime);
  var min = oTime.minutes();
  if (min == 0 || min == 30) {
  else if (min < 15) {
  else if (min >= 15 && min <= 45) {
  else if (min > 45) {
    oTime.hours( oTime.hours()+1 );
  appointmentTimer = setInterval(function() { 
    $("#appointmentTime").setValue( oTime.format("YYYY-MM-DD HH:mm") );
  }, 1000);
Where "appointmentTime" is the ID of the datetime field.

Here is a sample DynaForm to show its implementation:
(2.37 KiB) Downloaded 132 times
EMAIL Event Userid to Name

Hello, I am trying to use this trigger once again[…]

Any ideas in this regard? Thanks

Can anyone help me please??????

rabbidwombat, I have created a better code examp[…]