Expand my Community achievements bar.

Using LiveCycle, am I able to generate text fields based on which checkboxes are selected?

Avatar

Former Community Member

I'm looking into creating a form that will generate a letter based on the checkboxes selected, and I'm wondering if LiveCycle is the way to go. The form would have a number of checkboxes (approx. 60-70), and I would like to have the program generate text in 3 different sections based on which boxes are selected.

i.e.:

LOW

Checkbox A - selected

Checkbox B - not selected

MEDIUM

Checkbox C - selected

Checkbox D - selected

HIGH

Checkbox E - selected

Checkbox F - not selected

Then have separate sections to display a paragraph of text associated with each checkbox:

LOW importance items:
"Checkbox A text paragraph"

MEDIUM importance items:

"Checkbox C text paragraph"

"Checkbox D text paragraph"

HIGH importance items:

"Checkbox E text paragraph"

Any help is greatly appreciated! If my question wasn't clear please let me know and I can try to re-phrase.

Thanks!!

1 Reply

Avatar

Level 7

Hi,

This is absolutely a great way to do it. I have already created several forms that customise a letter to be output.

There are some considerations:-

• I use a setup page. On it i have the options (checkboxes) and buttons for Processing the Form and Resetting the Form.

• When you process the form, you will want to hide your setup page. This CANNOT be the first page. Livecycle restricts hiding of page 1 of the form. I coded mine so that the setup page is the last page and when the form opens, it goes straight to it (if it is visible)

• Use a reset button so the form can be reused easily

•  Include a hidden button to restore the setup page - for instance put a button over the logo on the presentable page and dont give the button a fill or border. Make it so you click it and the setup page becomes visible.

• There are other things you can do, such as add a preprogrammed password for restoring the setup page, when it is restored switch focus to it, etc.

For your current problem though:

You will need to have a flowable form and a button to process the form.

form1.pageDocumentSetup.btnProcessDocument::click - (JavaScript, client)

//hide text if unchecked.
if(this.resolveNode("checkboxA").rawValue == "0"){ this.resolveNode("checkboxAText").rawValue = null; }
if(this.resolveNode("checkboxB").rawValue == "0"){ this.resolveNode("checkboxBText").rawValue = null; }
if(this.resolveNode("checkboxC").rawValue == "0"){ this.resolveNode("checkboxCText").rawValue = null; }

//show text if checked
if(this.resolveNode("checkboxA").rawValue == "1"){ this.resolveNode("checkboxAText").rawValue = "this is some text"; }
if(this.resolveNode("checkboxB").rawValue == "1"){ this.resolveNode("checkboxBText").rawValue = "this is some text"; }
if(this.resolveNode("checkboxC").rawValue == "1"){ this.resolveNode("checkboxCText").rawValue = "this is some text"; }

//end code

If you have the text already in place and wish to hide and show simply replace .rawValue = "this is some text"; } with .presence = "visible";} or .presence = "hidden";} - If you have a flowable form the text placeholders will adjust up and down. Tip: Using Tables are great for flowable forms, just hide and show rows as needed.

The reason for having both checkbox states is that so if you return to the setup page later, you can edit and reprocess the form

Hope this helps you out. Forms are great!