Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By awisla
How to clear datetime field by javascript:
does not work as date format is required.

Thank you for help.
By Margrate
Hello Amos,

The given JavaScript code to clear datetime controls is working fine. But when we want to check the mandatory of the same datetime control based on conditions the value still exists at the backend so it is not checking the mandatory of the field.
Please find the attached .json.

Please help us on this.
(3.02 KiB) Downloaded 245 times
User avatar
By amosbatto
The problem is that the selected data is still in the model information for the field and I don't know how to set this. You can use setOnSubmit() to check whether the field is empty and display an alert to the user, like this:
Code: Select all
$("#clearDate").click(function() {

getFormById('64428352758068d2fe4eb97051094686').setOnSubmit(function() {
 if ($("#form\\[eventDate\\]").val() == '') {
    alert("Please set an Event Date.");  
    return false; //stop submit
Where '64428352758068d2fe4eb97051094686' is the UID of the DynaForm, and eventDate is the ID of the date field and clearDate is the ID of the button to clear the date field.
User avatar
By amosbatto
I filed a bug report about this, but the developers responded that the fileupload in version 3.1 allows a user to delete selected files. If you only want one file to be uploaded, you can use javascript to limit it with fileupload.
User avatar
By amosbatto
I found a solution in the JavaScript:
Code: Select all
$("#clearDate").click(function() {
where "clearDate" is the ID of the datetime control and "clearDate" is the ID of a button.

Everybody wants to be famous, but nobody wants to […]

Hi, I attached a sample config file, Please check […]

Error clicking on Participated

Hi, I attached a sample config file, Please check […]

Hello, Is it possible to set variables in a defau[…]