• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Conditional form

Community Beginner ,
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

423

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
Community Expert ,
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.

Votes

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
Community Beginner ,
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 ..

Votes

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
Community Beginner ,
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"

Votes

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
Community Expert ,
Aug 31, 2021 Aug 31, 2021

Copy link to clipboard

Copied

Post script you used.

Where did you put script?

Votes

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
Community Beginner ,
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 😬

 

Votes

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