Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Conditional form

New Here ,
Aug 31, 2021 Aug 31, 2021

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 🙏

TOPICS
PDF forms

Views

39

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 31, 2021 Aug 31, 2021

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2021 Aug 31, 2021

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 ..

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2021 Aug 31, 2021

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"

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 31, 2021 Aug 31, 2021

Copy link to clipboard

Copied

Post script you used.

Where did you put script?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2021 Aug 31, 2021

Copy link to clipboard

Copied

LATEST

Oh no sorry my mistake it's not on checkboxes it's on radio button 😬

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines