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

Script help using item value to make fields required and display

Guest
May 23, 2016 May 23, 2016

So I have a combo box that has five items listed (text a, text b,.....) and all the values happen to be 50.

I then have a hidden text field become visible and required when text a is selected. Problem is the script I am using is calculating based off the value (30), and sense all are (30), is there a way to use the item list (name) instead? Or a way to make this work?

Custom calculation script for text field

var d=this.getField("combo1").value;

if (d=="30")

{

event.target.display=display.visible;

event.target.required=true;

}

else

{

event.target.display=display.hidden;

event.target.required=false;

}

TOPICS
Acrobat SDK and JavaScript , Windows
264
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
LEGEND ,
May 23, 2016 May 23, 2016
LATEST

Do understand what the value of the combo box will  be when an item is selected and you have the "Optional Value" filled in?

Do you think you the value of the field will ever be 30 with your approach?

Have you considered adding some debugging statements your code to see what is happening?

Why are you using quotation marks around a number constant?

You only need quotation marks around character strings.

var d=this.getField("combo1").value;(;

console.show();

console.clear();

console.println("combo1 value: " + d)

console.println("d == 30: " + (d == 30);

if (d=="30")

{

event.target.display=display.visible;

event.target.required=true;

}

else

{

event.target.display=display.hidden;

event.target.required=false;

}

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