Copy link to clipboard
Copied
Hi everyone, I am creating a pdf form and I want to implement conditionnal formating.. I am very bad at java script, I hope you can help me.
I have a checkbox and I want to some fields to be "reqired" and other "inactive"only if it is checked..
Is it possible and is compatible with all pdf reader ?
Thanks 🙏
Copy link to clipboard
Copied
Here is some basic script you can use as Mouse UP event of checkbox:
if(event.target.value != "Off"){
this.getField("Text1").required = true;
this.getField("Text2").required = false;}
else{
this.getField("Text1").required = false;
this.getField("Text2").required = true;}
It will set one field required(true) while other not required(false), you can easily adapt it to your needs.
It probably won't work in all readers.
Copy link to clipboard
Copied
Hey thanks it almost work ^^
so when I check the box the field is required but when I uncheck it does not return to initial ..
Copy link to clipboard
Copied
+ I want my file to stay required untill the check box is ckecked. Here each time I hover the box it turns to "not required"
Copy link to clipboard
Copied
Post script you used.
Where did you put script?
Copy link to clipboard
Copied
Oh no sorry my mistake it's not on checkboxes it's on radio button 😬