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

Show/hide multiple fields if checkbox is activated

Community Beginner ,
Aug 29, 2018 Aug 29, 2018

Copy link to clipboard

Copied

Hi,hopefully it is an easy one... when you click the checkbox, it allows you to fill the other fields...

many thanks!!Singular Fact captura _476.jpg

TOPICS
Acrobat SDK and JavaScript

Views

723

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

correct answers 1 Correct answer

Community Expert , Aug 29, 2018 Aug 29, 2018

You can use something like this as the field's Mouse Up action:

var fields = ["Field1", "Field2", "Field3"];  // etc.

if (event.target.value=="Off") {

    this.resetForm(fields);

    for (var i in fields) this.getField(fields).readonly = true;

} else {

     for (var i in fields) this.getField(fields).readonly = false;

}

Votes

Translate

Translate
Community Expert ,
Aug 29, 2018 Aug 29, 2018

Copy link to clipboard

Copied

You can use something like this as the field's Mouse Up action:

var fields = ["Field1", "Field2", "Field3"];  // etc.

if (event.target.value=="Off") {

    this.resetForm(fields);

    for (var i in fields) this.getField(fields).readonly = true;

} else {

     for (var i in fields) this.getField(fields).readonly = false;

}

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 30, 2018 Aug 30, 2018

Copy link to clipboard

Copied

Thanks

Is this correct? It is giving me an error "unterminated string literal 1: en linea 2"

var fields = ["Titular de la cuenta", "Iban", "Entidad", "Oficina", "DC", "Nº de cuenta];  // etc. 

if (event.target.value=="Off") { 

    this.resetForm(fields); 

    for (var i in fields) this.getField(fields).readonly = true; 

} else { 

     for (var i in fields) this.getField(fields).readonly = false; 

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 30, 2018 Aug 30, 2018

Copy link to clipboard

Copied

You're missing the closing double-quotes after "cuenta" at the end of the array definition...

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 30, 2018 Aug 30, 2018

Copy link to clipboard

Copied

LATEST

Sorry! You are correct! 🙂

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