Expand my Community achievements bar.

Conditional Checkboxes

Avatar

Former Community Member

Hello There,

I'm new in Livecycle but actually i'm doing great till now . Actually I'm creating a fillable PDF form for my company so that it can be distributed out to clients.

In one part of the form, there is a table (Please check table 1.1) that I've created which includes a set of services listed and checkboxes to know if the client wants to inquire about that product or to use it for transactions.

table 1.1

ProductInquiry
Transaction
Time Deposits(Checkbox)(Checkbox)

what I want is that if the client checks the inquiry checkbox of time deposits, I want the transaction checkbox of the same product (time deposits) to be disabled.

on the other hand, when the client checks the transaction checkbox of that product, I want the following:

1- to disable the Inquiry checkbox of the same product, and

2- to add a number field on the rightside of the transaction checkbox (it doesnt matter if it is within the same cell or if it had to create a new column for that purpose) so that the client can add the maximum amount of money as numbers allowed per one transaction.

NOTE: I dont know Java, nor formcalc.

THANK YOU IN ADVANCE !!!

7 Replies

Avatar

Level 10

Hi,

Firstly, I think that you would fair better with radio buttons for inquiry and Transaction. As part of a radio button exclusion group, the user could only select one or the other.

In relation to showing/hiding the numeric field, there may be two options.

If you are using LC Designer ES2, then under the tools menu there is feature called Action Builder. You can use this to build up dynamic behaviour using simplified instructions. Action Builder will then populate the necessary script for you.

If you are using an earlier version then you will need to input the script. It is reasonably straightforward.

  • First check that the radio buttons have specified values, see the Object > Binding palette. For example, Inquiry may be "1" and Transactions may be "2".
  • Select the radio button exclusion group in the hierarchy (this will contain the two radio buttons). Then in the click event input the following Javascript:

if (this.rawValue == 2)

{

     NumericField1.presence = "visible";

}

else

{

     NumericField1.presence = "hidden";

}

  • Make sure that the form is saved as a Dynamic XML Form in the save as dialog.

There is an example showing the various presence properties here: http://assure.ly/h0zpOz

Hope that helps,

Niall

Assure Dynamics

Avatar

Former Community Member

Thanks Niall for your help.

On the other hand, I've been trying to apply what you've gave me, but it didnt work.

but let me tell you about the changes i've made after you gave me the idea of using radiobuttons instead of checkboxes.

I decided not to use the table anymore, just lines where the radiobutton is present and enough space on the right of the transaction radio button (which is found on the right of the inquiry radio button) for the numeric field to appear.

my other question is: should I insert a numeric field beside the radiobuttons? or it will automatically be generated after applying the formula you gave (or will give after these amendments )

Thanks for your time

Avatar

Level 10

Hi,

You would drag the NumericField onto the page, give it a name and then set its presence to hidden (see Object > Field palette). You would then amend the script to make sure it is referencing the name of the NumericField.

The script that I gave you will then change the presence of the NumericField depending on which radio button was selected.

Can you share your form? If so, upload it to a file sharing site and then post the published URL here.

Niall

Avatar

Former Community Member

Apperantly it's working; when I click the button number 2 the numberfield is showing up, but when I reclick button 1, the field does not disappear again.

I uploaded the file in the .tds form to make it easy for review. kindly advice. (btw, when testing the pdf, im using adobe dynamic xml form)

here is the link: 

https://public.me.com/mzhafzah

Avatar

Level 10

Hi,

You had the script in one of the radio buttons, this is why it only appeared to fire when that radio button was clicked.

I have moved the script to the click event of the radio button exclusion group.

See the form here: https://acrobat.com/#d=M1VrAp88J4WCZ0p*lXNg-Q

Hope that helps,

Niall

Avatar

Former Community Member

Niall,

Everything worked perfect (Y)   Thanks for the help.

I just need one more advice and that's it.

As I said, I was applying the condetional radiobuttons without using tables; that was space consuming, so I thought of making a table with the following columns:

1- Service type

2- Inquiry (this will include in each cell a radio button for the inquiry)

3- Transactions (this will include in each cell a radio button for the transaction)

4- Amount (will contain a conditional numeric field if the transaction radio button is ticked)

The problem now is that the numericfield cannot be sat as Hidden in the presence option. ( it can be sat as hidden if the numeric field is not found inside a table cell)

Note: I fixed the relation between the two radio buttons (inquiry and transactions) and they are related when testing it on the dynamic xml form

Avatar

Level 10

Hi,

There are a couple of things I think you need to consider.

Looking at radio buttons outside of a table first. You will see that when you have a number of radio buttons that are linked, in the hierarchy they are grouped inside a radio button exclusion group. The default behaviour for this is that at runtime only one radio button can be selected.

When dealing with tables, you can have radio button exclusion groups in the tables, HOWEVER you cannot get the radio button exclusion group to span across multiple cells in the table. All of the radio buttons in an exclusion group must be on one cell. This will allow the in-built behaviour where only one radio button can be selected.

Now, you can use checkboxes in different cells and change their appearance to look like radio buttons. However this solution requires script, for example: http://assure.ly/dRYa1c.

In your case I would be inclined to have three columns:

  1. Service type;
  2. Transaction type
  3. Amount

In the transaction type you would have a two button exclusion group, where one radio button would have a caption "Inquiry" and the other "Transactions".

In relation to the showing/hiding the numeric field, you can do this will script. There is an example here, where the presence of the move/edit columns are changed (click event in the edit button on Tables 5 and 6): http://assure.ly/dRYa1c.

So you could have script in the docReady event of radio button group to show or hide the numeric field.

Hope that helps,

Niall