Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Making a section visual

Avatar

Level 5

Good Morning;

I hope this will turn out to be somewhat of a simple question to answer….

In a form I have one section that is need to be completed if the user selects a checkbox. Example: Does this change require management approval; Yes   No

If the user selects “Yes” I would like the section for the manager approval to become visual. There are a totla of 3 fields in this section.

If they select “No” the section remains hidden.

Question. Do I need to create a subform for the Manager approval?

Thanks All

11 Replies

Avatar

Level 2

On the manager approval text field/sub form,

insert the following code on click

(this is javascript)

if

( this.rawValue == 1 )

{

your field.presence = "visible"

}

else

{

your field.presence = "hidden"

= "";

}

Avatar

Level 6

Yes, it will be better way if create subform.

Place those 3 fields in the subform and make the presence of the subfom to "visible" or "hidden" depending on ur requirement. Make sure you save the pdf as dynamic.

Without subform also u can make the same but same code has to be write for all 3 fields presence to  "visible" or "hidden".

RAGHU.

Avatar

Level 5

Thanks …….

I must be have a “dumb” day (let’s not debate the time factor).

Before I forget, I am using LiveCycle Designer 8.0

Not mater what I try I am not able to get this to work. This is what I did . I would appreciate any and all comments

I created a new form with 2 text fields, 1 checkbox

Then created a new sub form called manager.

In the sub form I created 2 text fields and set

Set the manager sub form to hidden

Saved form as dynamic

Added the java script (language=javascript)to the checkbox and changed the code to

“manager.presence = "visible"”

And

manager.presence = "hidden"

When I brought the form up in Acrobat 9 and clicked the checkbox…. Nothing happened.

Next

Recreated the form without the sub form and changed the java script as follows

if

( this.rawValue == 1 )

{

TextField3.presence = "visible"

}

else

{

TextField3.presence = "hidden"

= "";

}

Did not work.

Here is source file after added the code to the form. I added this at the top of the form by highlighting the checkbox, Selecting “click”

<field name="CheckBox1" y="53.975mm" x="31.75mm" w="28mm" h="6mm">

            <ui>

               <checkButton>

                  <border>

                     <?templateDesigner StyleID apcb2?>

                     <edge stroke="lowered"/>

                     <fill/>

                  </border>

               </checkButton>

            </ui>

            <font typeface="Myriad Pro"/>

            <margin leftInset="1mm" rightInset="1mm"/>

            <para vAlign="middle"/>

            <value>

               <integer>0</integer>

            </value>

            <caption placement="right" reserve="21mm">

               <para vAlign="middle"/>

               <font typeface="Myriad Pro"/>

               <value>

                  <text>Check Box</text>

               </value>

            </caption>

            <items>

               <integer>1</integer>

               <integer>0</integer>

               <integer>2</integer>

            </items>

            <?templateDesigner ScriptInitializers click::lang=JavaScript;?>

            <event activity="click">

               <script contentType="application/x-javascript">if

( this.rawValue == 1 )

{

TextField3.presence = "visible"

}

else

{

TextField3.presence = "invisible"

Avatar

Level 2

Send me the form I will take a look at it for you.

Avatar

Level 2

You need to move the script form the checkbox to the subform as well.

Avatar

Level 10

I did a sample form for you with the Subform approach. Hope this helps.

Let me know if you need any clarifications..

https://acrobat.com/#d=X5uHGqVX-lbLltZvqq*3tg

Thanks

Srini

Avatar

Level 5

Thanks.

Tried adding the script to the sub form. Nope.

Adobe has turned off the ability to attach files for the time being. I will attached the form once they turn this back on. Unless you want me to past the code here.

The "test" for is 353 lines.

Thanks rghLiquidAxis

Avatar

Level 5

Thanks for the form Srini

Your form work well. I do get a message “This PDF requires a newer version of Adobe Designer ……”

I am running Adobe LifeCycle Designer 8.0 ( 8.05.2073.1.37024). This might make some difference. An example. At the start of your code for the checkbox you have the following line.

<event activity="click" name="event__click">

When I add the Java script I have the following line

<event activity="click">

I am missing the “name=”

After I added the java script I add the “name=” to the line.

I have saved this as both Adobe 7, Adobe 8 Dynamic & Static form. Still does not work.

I have uploaded one of the files I was working on

https://acrobat.com/#d=FWpr6bgmjf9m6vx*A1QGXw

Thanks again

Avatar

Level 2

I changed the script a little..You should be good to go.

if( this.rawValue == 0 )

{

manager.presence = "invisible"

}

else

{

manager.presence = "visible";

}

**you also need to save the form as a Adobe Dynamic xml form as well for it to work (I have fixed your issue with your file should be attached. I also apologize for giving you the wrong syntax.)

Avatar

Level 10

As rghLiquidAxis mentioned, you did not save your file as Dynamic..The updated file is available for you to view.

I only changed the form to be dynamic. The form is set to run in "Adobe Acrobat and Reader 8.0 or later".

You do not need to change anything in the XML tab. Better avoid changing the XML Source directly.

https://acrobat.com/#d=XWTQIwajPCC*JIiN-ooCqg

You need do the following to make the script work.


     1) Goto File menu -> Form Properties and select Defaults tab. Change the Default Render Format as Dynamic XML form

     2) Select the Preview Tab. Set the Preview type as "Interactive Form" and Preview Adobe XML form as Dynamic XML form

     3) Finally while saving the PDF select Save As Type as "Adobe Dynamic XML Form".

If you use manager.presence = "invisible", the subform will not be visible for the user but occupy space on the form..

If you use manager.presence = "hidden", the subform will not be visible for the user and also does not occupy space on the form..

You can use anyone based on your need.

Thanks

Srini

Avatar

Level 5

Good Morning;

Works like a charm. Thanks all. Now to put what you folks taught me to the test.

Thanks Again