cancel
Showing results for 
Search instead for 
Did you mean: 

Show Hide Fields on Event

Former Member
0 Kudos

Hello

I am new to LiveCycle Forms and I want to show/hide Text field on Checkbox check/uncheck event.

How can I do this?

I have a checkbox named "CheckBox1[0]" and a StaticText named "StaticText7".

I am writing the following code on click event of "CheckBox1[0]"

if (CheckBox1[0].rawValue == 1)

{

StaticText7.presence = "visible";

}

else

{

StaticText7.presence = "invisible";

}

But it gives me an error:

Syntax Error near token '{' on line 2,column 1

Accepted Solutions (0)

Answers (3)

Answers (3)

OttoGold
Active Contributor
0 Kudos

Have you found the solution? Maybe you can share the solution with us and close the thread:)) Have a nice day, Otto

chintan_virani
Active Contributor
0 Kudos

The default language is FormCalc and the code you have written is JavaScript so change it to JavaScript from the Script Editor and it should resolve the issue.

Also the if else condition for hiding a text field does not look okay to me.

You should hide the Static Text in the form:ready event of main top level subform and in the click event of the Check Box you should just make it visible.

Chintan

OttoGold
Active Contributor
0 Kudos

Hello,

looks like you´re a beginner. There some very fundamental rules when designing forms:

1) Name your form fields. It helps to maintain he forms, helps to read it etc.

2) I hope you´ve noticed there are two possible scripting languages, check if you´re using the right one. If you don´t like the one which is default, change this default cripting language in your preferences.

3) Use the right path: you can use this.presence to address the element the script runs on presence, or you should start with your root element like form.mysub1.mysub2.myfield (compare with your path)

4) note: there is a parent pointer, useful like this, this means "me", this.parent means "my parent", so for the field this.parent means the subform i am wrapped in.

5) check what event you´re using, sometimes one is better than the other, sometimes some events doesn´t work the way you need. Very useful are button.click, initialize etc.

6) start reading before programming:

http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf

Regards, Otto

p.s.: we are not going to debug your code, you do that