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

Learn more

View all

Sign in to view all badges

Conditional Fields

Avatar

Level 1

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.

9 Replies

Avatar

Level 2

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

Avatar

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?

Avatar

Level 2

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

Avatar

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.

Avatar

Level 2

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

Avatar

Level 1

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

Avatar

Level 2

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.

Avatar

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.

Avatar

Level 1

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

couldn't have done it without you!