Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By nikidinsey
#790033
Hi all,

Our first workflow is now live at school. We have 150 boys registering their work experience requests as we speak and it's going really well. Thank you for an excellent product.

I have a question related to form validation. I have many form fields with the "required" checkbox ticked which works as expected. I need some dynamic "if this, then x is required" style validation (sorry I don't know the right terminology!).

Basically, I need something to do the following "If radio input @@empHsReq ID = 2, make @@empHsFile required".

https://www.screencast.com/t/N45kuFxYdHp

Hope this makes sense, any tips greatly appreciated!
By zainab
#790035
Hello,

You can use the below Javascript to either enable or disable the required property for a field, but keep in mind this will only work if the required property is marked for that particular control in properties section:
Code: Select all
$("#empHsFile").disableValidation();
$("#empHsReq").setOnchange(function(newVal, oldVal) {
    if (newVal == 2)
        $("#empHsFile").enableValidation();
    else
       $("#empHsFile").disableValidation();
});
Here replace "value_of_radio" with the value of the radio button in your dynaform.

Hope this helps.

Best Regards,
Zainab Sabunwala
By nikidinsey
#790037
Hi Zainab,

Thank you very much for this, I didn't know about the JavaScript feature available on the outer Dynaform. I've embedded your code and its worked flawlessly! Thanks a lot!

Niki
By rhbooth
#814501
I am trying to do something similar but with a checkgroup. How do I make selections in the checkgroup dynamically require validation on subsequent fields in my form?
User avatar
By amosbatto
#814503
Let's say that in Form1 you have a checkbox associated with the variable "requireProducts".

Then in Form2, add a hidden field associated with the variable "requireProducts". Then, add the following JavaScript to Form2:
Code: Select all
var required = $("#requireProducts").getValue();
if (typeof required == "object" && required[0] == "1") {
  $("#selectProducts").enableValidation();
} else {
  $("#selectProducts").disableValidation();
}
Where "selectProducts" is the ID of a checkgroup.

Attached is a example process:
(28.38 KiB) Downloaded 248 times
By rhbooth
#814515
amosbatto,

Thank you for that and it is very useful for me in the future.

Is it possible to do that in the same form? I have several selections in a checkgroup for actions for a manager to take for an employee such as promotion, title change, pay change, employment type change, etc. Then I have associated text fields or drop downs for managers to fill out. I would like to have the checkgroup selections apply validation to the associated fields in the same form. I can make it work with individual checkboxes, but that makes some follow on processes outside of PM more difficult.

Thank you!

Web3 development encompasses creating decentralize[…]

The Upland Clone Script, offered by Dappsfirm, rep[…]

Dappsfirm offers a bet365 clone script that mirror[…]

🚀 Tauchen Sie mit Immediate Alora AI in die Welt d[…]