Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

If/then statement with hidden fields

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

03-02-2012

I have a form with a drop-down field that has 3 possible values (Today, Tommorrow, Next Week). Below this drop-down field is text field (TextField10) that needs to be filled out by the user ONLY if "Next Week" is selected in the drop-down. I would like for TextField10 to be hidden unless "Next Week" is selected.

For TextField10, I have "this.presence="hidden" written into the initialize event so it is hidden when the user opens the form. This works.

For the drop-down field, I have:

if (this.rawValue == "Next Week") then TextField10.presence = "visible";

     endif

written into the exit event in FormCalc. I need this in FormCalc because I have many other scripts in the exit event already written in FormCalc and I don't want to have to change all of them. I have checked "Specify Item Values" in the Binding Tab of the drop-down field.

Would someone please tell me what I am doing wrong. TextField10 is hidden, but never appears no matter what I select in the drop-down field.

thank you for your help!

Gene-O

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
Jono_Moore
Level 8

08-02-2012

It may need to be saved as a dynamic form, not sure. Is your test form dynamic?

Answers (8)

Answers (8)

Avatar

Avatar
Validate 1
Level 5
whyisthisme
Level 5

Likes

41 likes

Total Posts

324 posts

Correct Reply

59 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 5
whyisthisme
Level 5

Likes

41 likes

Total Posts

324 posts

Correct Reply

59 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
whyisthisme
Level 5

05-02-2012

You can also do this easily in the exit event in formcalc:

if ($ == 3) then

TextField10.presence = "visible"

else TextField10.presence = "hidden"

endif

(assuming Next Week has a specified value of 3)

Avatar

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
Jono_Moore
Level 8

03-02-2012

The value selected for dropdowns work a little differently. You have to get the new value of the selection and I think you can only use the Change event for this (could be wrong).

Also you're mixing some JavaScript syntax in with your FormCalc.

I added code to hide the field should they make another selection.

JavaScript:

var selection = this.boundItem(xfa.event.newText);


if (selection == "Next Week") {

     TextField10.presence = "visible";

}

else {

     TextField10.presence = "hidden";

}

And just tried it in FormCalc:

var selection = this.boundItem(xfa.event.newText)


if (selection eq "Next Week")

then TextField10.presence = "visible"

else TextField10.presence = "hidden"

endif

Avatar

Avatar
Validate 1
Level 1
JainSa
Level 1

Likes

2 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Validate 1
Level 1
JainSa
Level 1

Likes

2 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Applaud 5
Affirm 1
View profile
JainSa
Level 1

06-07-2018

Hi ,

May i need one help.!

i was created one Text field and then binding the data .

in Binding Field the User Does not Enter the Value .?

How to show  N/A in created text field.

Avatar

Avatar
Level 1
dtinglin
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
dtinglin
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
dtinglin
Level 1

13-02-2018

Mr. Moore,

I'm new to coding and I have a project I'm working on. I have a button that allows a user to attach a PDF to the form. My script works fine

if (app.viewerVersion < 11) {

    import_pre_11();

} else {

    import_11();

}

but I wanted to know is there a conditional script (If/then) that I can use to validate a hidden field value (If the click action is Cancel then the hidden text value= "" but if the click action is Select then the hidden text value is "File Attached")?  I hope that made sense. I'm using Adobe Pro DC.

Thank you!

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

08-02-2012

Jono - you are correct! When I saved it as dynamic, it worked. Thanks SOOOOOOO MUCH!

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

08-02-2012

No, it’s Static.

Lt. Gene Schrieber

Alabama Alcoholic Beverage Control Board

Enforcement District 1

P.O. Box 1755

Florence, Alabama 35631

(256) 764-2435

(256) 766-1793 Fax

www.abc.alabama.gov

"Attitude is a choice"

Avatar

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 8
Jono_Moore
Level 8

Likes

111 likes

Total Posts

1,151 posts

Correct Reply

144 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
Jono_Moore
Level 8

08-02-2012

Is the form saved as "dynamic"?

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

08-02-2012

Thanks for the replies!!

If I create a test form, these scripts work perfectly. For some reason, they won't work on the form I need them to.

Any ideas?????

thanks!!!