So, I was able to switch a part of my calculations into validations scripts but there is one remaining that I don't know how to figure out.
This is the calculation of the "Découpe" field.
Basically, what I wanted from that calculation is to check the box " Dessin" when one of those field is not empty or when a specific radio button is at yes.
If field Découpe or Assemblage-Dessus or Assemblage pattes is not empty
OR if Porteafaux is checked at YES
OR if field Moulurage value is Personnalisé
Then I want my Dessin checkbox to be checked
I don't know how to do it differently by using validation script in each field. Every try I made didn't work out well. My value was cleared by the choice made in my second drop down. Even if Decoupe field was not empty, when I cleared field Assemblage-Dessus, it just cleared Dessin box, but my field Decoupe was still filled.
More, I don't know how to add my radio button into that condition.
Wondering if you could help me again,
Thanks
Good for you!! It's well worth the effort to try different ways to script a behavior, even if it doesn't work out. However, since setting the "Dessin" depends on several inputs, it is appropiate to use a Calculation Script, just not on the dropdown. Instead, put a new text field next to the "Dessin" checkbox, and use the calculation script on this text box. Make this text field hidden. This separates the code for the calculation from the source fields.
Now you need to learn a bit about how to write calculations.
These short article can help:
https://www.pdfscripting.com/public/Calculating-field-values-and-more.cfm
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
In this case the calculation isn't with numbers, but with boolean values.
Here's the calculation script for the hidden text field next to the "Dessin" checkbox
var bDessinValue = (this.getField("Decoupe").valueAsString != "0")
|| (this.getField("Assemblagedessus").valueAsString != "0")
|| (this.getField("Assemblagepattes").value != 0)
|| (this.getField("Moulurage").value =="Personnalisé")
|| (this.getField("Porteafaux") == "Oui");
this.getField("Dessin").value = bDessinValue?"Yes":"Off";