Skip to main content
Participant
Aug 2, 2018 7:34 PM UTC
Question

How to show/hide a field based on another field.

I have the following document level script:

function Openn(){
        if(this.getField("cobuyer").value.length == 0)
        {
           this.getField("xcobuy").display = display.hidden;
        }

     else
        {
            this.getField("xcobuy").display = display.visible;
        }

                }
Openn();

I am getting the following error:

Acrobat EScript Built-in Functions Version 10.0
Acrobat SOAP 10.0

TypeError: this.getField("xcobuy") is null
9:Document-Level:Openn

The form is being produced with the data already in it and that field is not null

Thanks

Jasper

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

try67
Community Expert
Community Expert
Aug 2, 2018 8:02 PM UTC

That means the field name you entered is incorrect. Make sure you spell it EXACTLY as it appears on the page, including lower/upper-case letters.

Translate
Participant
Aug 2, 2018 8:15 PM UTC

Thanks for the reply.

I copied/paste the name of the field.  It is exactly what is on the form.

Thanks,

Jasper

Translate
Participant
Aug 2, 2018 8:17 PM UTC

Is it possible that I may need to add a delay to the routine?

Translate