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

Adobe Forms - Text Field Visible based on Dropdown Selection

New Here ,
Sep 17, 2017 Sep 17, 2017

It seems simple enough, but I'm not sure what I'm doing wrong. I want TextFieldIwantvisible1 and TextFieldIwantvisible2 to appear if Dropdown1 or Dropdown2 is selected. But the default is to keep the Text fields hidden. Here's what I have below. Any help or guidance would be greatly appreciated. I've placed the code in the run custom validation script.

var f=this.getField("TextFieldIwantvisible1");

var g=this.getField("TextFieldIwantvisible2");

if(event.willCommit)

{

console.printtln(event.value);

switch(event.value)

{

case "Dropdown1":

f.display = display.visible;

g.display = display.visible;

               break;

case "Dropdown2":

f.display = display.visible;

g.display = display.visible;

               break;

Default:

f.display = display.hidden;

g.display = display.hidden;

               break;

}

}

TOPICS
Acrobat SDK and JavaScript
611
Translate
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 , Sep 17, 2017 Sep 17, 2017

Get rid of the event.willCommit part, and make sure that the field is set to commit the selected value immediately, and it should work.

If it doesn't, check the JS Console for error messages.

Translate
Community Expert ,
Sep 17, 2017 Sep 17, 2017

Get rid of the event.willCommit part, and make sure that the field is set to commit the selected value immediately, and it should work.

If it doesn't, check the JS Console for error messages.

Translate
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 ,
Sep 17, 2017 Sep 17, 2017

Hello There!

Thank you for your reply. I tried the following, with no luck... I also did not receive any error messages. Is there possibly something wrong with the syntax?

var f=this.getField("TextFieldIwantvisible1");

var g=this.getField("TextFieldIwantvisible2");

{

console.printtln(event.value);

switch(event.value)

{

case "Dropdown1":

f.display = display.visible;

g.display = display.visible;

               break;

case "Dropdown2":

f.display = display.visible;

g.display = display.visible;

               break;

Default:

f.display = display.hidden;

g.display = display.hidden;

               break;

}

}

Translate
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 ,
Sep 17, 2017 Sep 17, 2017

Made a silly mistake just figured it out.. Thank you so much!!

Translate
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 ,
Sep 17, 2017 Sep 17, 2017
LATEST

Yes, actually, it's "default", not "Default"...

On Sun, Sep 17, 2017 at 6:02 PM, darlyj38956125 <forums_noreply@adobe.com>

Translate
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