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

Form using custom validation script not saving properly

New Here ,
Jan 24, 2018 Jan 24, 2018

Hi all,

I am trying to create a form that allows our customers to view different styles of each of our items. I am working in Adobe Acrobat on a Mac. Under each item, is a drop-down 1 which runs custom validation script to populate drop-down 2 which runs custom validation script to either show or hide an image of the chosen finish below using a button (image is used as the button icon).

So for instance, if they choose Door Style 29, in drop-down 1 they select the type of species they would like to use. From there they are given color options in drop-down 2. Once they choose a color in drop-down 2, and image appears below. This is pictured below:

Screen Shot 2018-01-24 at 11.54.35 AM.png

Here is what my script looks like:

Script for drop-down 1 (Style29):

switch (event.value) {

    case "Eurolaminate":

        this.getField("Sub29").setItems(["Alpine Oak","Barn Pine"]);

        break;

    case "-":

        this.getField("Sub29").setItems(["-"]);

        break;  

}

Script for drop-down 2 (Sub29):

this.getField("Alpine Oak").display = event.value=="Alpine Oak" ? display.visible : display.hidden;

And so on for each additional item

My script works fine when I preview it in Adobe Acrobat. As soon as I save the file however, the drop-downs no longer work as they are supposed to and the color image never appears. This is the case in both Preview and Adobe Acrobat. I have also tried saving it as "Reader Extended PDF >> Enable More Tools". How can I save the file so that it works as it does when previewing it?

TOPICS
PDF forms
1.7K
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 ,
Jan 24, 2018 Jan 24, 2018

Don’t expect forms to work in Preview. Don’t use it at all! It is notorious not only for limited support but for delivering corrupt forms. You must give you customers very clear instructions to use only Adobe products, and not to expect this to work on their tablet or phone.

You say “script for <field>“ but there is a world of difference between the different actions. What is good in calculate may be disastrous in validate, and so on. What specific script is it?

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 ,
Jan 24, 2018 Jan 24, 2018

I am using validate

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 ,
Jan 24, 2018 Jan 24, 2018

You are doing too much for a validate script. If the validate script does more than validate, it needs to be something else. Generally if you want a DIFFERENT field to change, you set the calculate script of the other field.

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 ,
Jan 24, 2018 Jan 24, 2018
LATEST

That's helpful. I moved the script from Drop-Down 2 to calculate instead of validate. Now the script for drop-down 1 is working correctly after I save. However, the script for drop-down 2 (to hide or unhide the image (button) of the item selected in drop-down 2) still isn't working. Any suggestions as to how I should proceed?

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