0

I have a problem in using checkbox in ProcessMaker 4. In version 3 I had this code:

$("#amount").setOnchange(function(newValue, oldValue) {
  $('#myCheckbox').show();
  
  var amount2 = $("#amount2").getValue();
  if(newValue >= amount2){
    $("#myCheckbox").setValue("1");
  }
  else{
    $("#myCheckbox").setValue("0");
  }
});

how can I implement this in version 4?

1 Answers1

0

You should be using watchers. Create a watcher that monitors the amount variable for changes. Whatever code you put in the watcher will execute each time the variable changes. There you can add the code to set the value of the checkbox variable to whatever you need. When configuring the watcher remenber to define the input variables wich is basically a json maping whatever variables will be available to the watcher script to your current variables in the screen... Example:

{"Variable_in_script":"{{Variable_in_screen}}"}
osantos
  • 352
  • 2
  • 18