9 Replies Latest reply on Apr 25, 2011 10:00 AM by MorganKnives

    Conditional Fields

    MorganKnives

      I'm a fairly new LiveCycle user and my Java is shaky (at best) but I'm trying to build a form that I know is probably going to require some scripting.

       

      Essentially, I want to make a form with fields that are disabled unless another field has a certain value (or is within a certain range of values) .

       

      For example, if a numeric field (let's say it's called "number_ads") has an entry of "3" other fields are now visible. Or if these is a check box that I want to enable/disable a separate field.

       

      Thank you in advance! Even if you don't know exactly what I need to do, if you could show me the direction of a good tutorial, I'd be very appreciative.

        • 1. Re: Conditional Fields
          Worsty2 Level 1

          If you are using livecycle ES2 you can use the action builder.  From the top menu bar click on Tools, Action Builder and add an action with a condition and result.  You can show/hide fields on your form based upon the value in another field.  

           

           

          Debbie

           

          "Life is half spent before we know what it is."

           

          George Herbert

          • 2. Re: Conditional Fields
            MorganKnives Level 1

            That sounds like it would be great, sadly, I'm sporting the old ES 8.2 version.

             

            Is there a similar type thing in the older version or is scripting my only option?

            • 3. Re: Conditional Fields
              Worsty2 Level 1

              In older versions scripting is the only option.  You would do something like this if you are using JavaScript:

               

              switch(xfa.event.newText) {

                  case 'A - Approved':

                      form1.Page1.2nd_Title.presence = "visible";

                      form1.Page1.2nd_Signature.presence = "visible";

                      break;

                 default:

                      form1.Page1.2nd_Title.presence = "hidden";

                      form1.Page1.2nd_Signature.presence = "hidden";

                      break;

              }

               

              Of course, you would need to add/change your field names and what action you want to happen: visible/hidden etc.

               

              Debbie

               

              "Life is half spent before we know what it is."

               

              George Herbert

              1 person found this helpful
              • 4. Re: Conditional Fields
                MorganKnives Level 1

                Great! Thank you so much! One more thing, how do I define the rules for the case and/or variable? Like I said, my Java is pretty bad, I'm still at the early stages of learning.

                • 5. Re: Conditional Fields
                  Worsty2 Level 1

                  Take a look at this form.  If you click in the Drop-down List: dropdown and select one of the options you will note that another field appears next to it and you can choose from it and show/hide different fields in the form.  If you open it in LiveCycle and go to the code events of these fields you can see how it is coded.

                   

                   

                  Debbie

                   

                  "Life is half spent before we know what it is."

                   

                  George Herbert

                  • 6. Re: Conditional Fields
                    MorganKnives Level 1

                    Was there supposed to be something attached? Sorry for being a bother.

                    • 7. Re: Conditional Fields
                      Worsty2 Level 1

                      If you put your personal email address in here I'll s

                      end it to you.  I guess that you can't put attachments in these posts.

                      • 8. Re: Conditional Fields
                        MorganKnives Level 1

                        Figures. I think I have the code figured out and now LiveCycle won't even start without crashes upon opening any file (even new ones). I swear it worked fine yesterday!

                         

                        Nevermind, just needed to delete the profile.

                        • 9. Re: Conditional Fields
                          MorganKnives Level 1

                          Nevemind! I figured out my problem! Thank you so much for your help! I

                          couldn't have done it without you!