Expand my Community achievements bar.

SOLVED

How can I force an “invisible” object to become “visible” when a numeric value is entered?

Avatar

Level 2

So I’m trying to force an “invisible” subform to switch to “visible” when a numeric value greater than or equal to 22 is input into a numeric field.

I can’t get the following javascript code to work properly with any event. I’ve tried the change, calculate, validate, events and a few more to no avail. The only event that kind of works with the javascript code I’m using is the validate event. When I input the code into the validateevent, the invisible subform becomes visible when an amount equal to or greater than 22 is entered, but when ANY amount is input into this field, an error message pops up that says “NumericField4 validation failed” and the user has to click “Ok” to get rid of the pop up box.

if (this.rawValue <= 22) {

        Approval23.presence = "hidden";

    }

if (this.rawValue >= 23) {

            Approval23.presence ="visible";

        }

Here’s a link to my .pdf: http://www.filedropper.com/salgovform

The object field that the javascript code is contained in is called: NumericField4 (a.k.a. New Job Grade)

The subform that I want to become visible when a number greater than 22 is input into NumericField4, is called Approval23.

I’ve based the javascript code I used on information I gathered from the following thread and associated .pdf . . .

Thread:

http://forums.adobe.com/message/1982919

PDF in thread with the javascript code:

http://forums.adobe.com/servlet/JiveServlet/download/1981437-8059/Sample_SW.pdf

I’m pretty sure I’m just missing one little thing that’s throwing everything off!

Any help would be GREATLY appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The following works in the exit event of the numeric field, where the language is set to JavaScript:

if (this.rawValue <= 22) {

     Approval23.presence = "hidden";

}

else {

     Approval23.presence = "visible";

}

Here is your form: https://acrobat.com/#d=3gRNt6WBY2bE0K7en4CnSA

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

The following works in the exit event of the numeric field, where the language is set to JavaScript:

if (this.rawValue <= 22) {

     Approval23.presence = "hidden";

}

else {

     Approval23.presence = "visible";

}

Here is your form: https://acrobat.com/#d=3gRNt6WBY2bE0K7en4CnSA

Hope that helps,

Niall

Avatar

Level 2

PERFECT! Thanks Niall!

So simple . . . I knew I was just a little off.