Page 1 of 1

Change Protected Value of DynaForm by Javascript or Trigger

Posted: Tue Apr 28, 2020 10:55 am
by kleung
Hi,

I would like to change the Protected Value of a Control, eg a Text field, in a DynaForm subject to the value of a flag.
Grateful if I can be advise how the Protected Value can be changed by Javascript of the the Dynaform or a Trigger before the Dynaform.

Thank you very much.
cheers,
Karl

Re: Change Protected Value of DynaForm by Javascript or Trigger

Posted: Wed Apr 29, 2020 1:56 pm
by RicardoMG
Hello!

The protected field only prevents the user from changing the value in the form, but in triggers it should be possible to change like any variable
@@ variable = new_value;
For more information about trigger, you can review this link:
https://wiki.processmaker.com/3.2/Triggers

Best regards, Ricardo.

Re: Change Protected Value of DynaForm by Javascript or Trigger

Posted: Wed Apr 29, 2020 8:32 pm
by kleung
Hi Ricardo,

I need to change the Protected Value of a Control because in some cases, users are allowed to input/value to the field in the DynaForm while in some cases, users are prohibited to do so. Hence I need to modify the Protected Value on the fly.

Where is the value of the Protected Value stored? What is the data structure?

Many Thx
cheers,
Karl

Re: Change Protected Value of DynaForm by Javascript or Trigger

Posted: Thu Apr 30, 2020 10:50 am
by RicardoMG
Hello!

I carried out an example process with the following characteristics:
1. I have 2 tasks A and B
2. I created 3 variables: name, lastName, email.
3. I created a dynaform
3. Each variable is associated with each dynaform control.
4. The control associated with the name variable has selected in its properties as a protected value.
5. I created a trigger where I assign a new value to the varaible name
6. I assign the trigger before the dynaform of task B
So as I told you, only by means of a trigger can you change the protected value of a variable.
I also attach the example process that I made and also a video for you to view.

Best regards, Ricardo.

Re: Change Protected Value of DynaForm by Javascript or Trigger

Posted: Thu Apr 30, 2020 9:20 pm
by kleung
Hi Ricardo,

Got it.
Thank you very much.

cheers,
Karl

Re: Change Protected Value of DynaForm by Javascript or Trigger

Posted: Sat Jan 22, 2022 2:09 pm
by ljglmail
You can use the Change Protected Value of Dynaform by JavaScript or Trigger function to protect a field's value from change in the web Dynaform.

You will need to create a trigger and add it to the form template where you want to protect your fields. For example, if you have a form template with a field named as "Amount", then you can add the trigger to that particular field.