コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

If/then statement with hidden fields

Avatar

以前のコミュニティメンバー

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

1 受け入れられたソリューション

Avatar

正解者
Level 10

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

元の投稿で解決策を見る

9 返信

Avatar

Level 10

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

Level 7

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

以前のコミュニティメンバー

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!!!

Avatar

Level 10

Is the form saved as "dynamic"?

Avatar

以前のコミュニティメンバー

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

正解者
Level 10

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

Avatar

以前のコミュニティメンバー

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

Avatar

Level 1

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

Level 2

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.