Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Checkboxes

Avatar

Former Community Member
Hi I have created a form which uses checkboxes. A customer needs to check one or more of the boxes in order to show the subforms related to the checkbox.



Now when the customer uncheck the box the subforms stays visible.



With Radio button it works as i use the folowing



Content.subGeneralTB.presence = "hidden" to hide

or

Content.subGeneralTB.presence = "visible" to show



I gues I need to use a value or something in order to work in a checkbox.



Thanks for the help
15 Replies

Avatar

Former Community Member
The same thing applies ....you just need make sure that you are checking the value of the checkbox instead of the container that holds them (unlike the RadioButtonGroup object).

Avatar

Former Community Member
I used the following script in javascript and i got no errors with the debugging



if (chkCatWS.value =1)

item.presence = "visible";

else(chkCatWS.value =0)

item.presence = "hidden";



But when i try it out it doens't work.

Avatar

Former Community Member
In the if and else portions of the command you are comparing two values. . In Javascript you need a double equal sign for that. Also you need an if after the else portion....so the script would be:



if (chkCatWS.value == 1) {

item.presence = "visible";

}else {

if (chkCatWS.value == 0)

item.presence = "hidden";

}

}

Avatar

Former Community Member
Paul,



if I adapt your script to the following



if (Content.subGeneralTB.fldAprNr.rawValue !="" ){

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

}else{

app.alert("Please fill in your reference");

}



it doesn't work. If I add rawvalue !="1" then it works. Do you have another idea how javascript would recognise an empty field?

Avatar

Former Community Member
Paul the previous message was for the block printing.

Avatar

Former Community Member
do an app.alert(Content.subGeneralTB.fldAprNr.rawValue)and see what the value is....my guess is that it is null and not ""

Avatar

Former Community Member
Hi Paul,



thanks for the help for the block printing it works.



But I still have a problem with the checkboxes. When I check the box the hidden field will appear. But afterwards I cannot uncheck the box in order to rehide the field.



Maybe I use a wrong event. I used click, mouseexit, change



Is there a way when I use multiple checkboxes that all the checkboxes are checked at the end?



By the way here is my code so far



if (CheckBox1.value ==1) {

TextField1.presence="visible";

} else {if (CheckBox1.value ==0)

TextField1.presence="hidden";

}

Avatar

Former Community Member
Hi,

Put this code under click on the checkbox:



if (CheckBox1.rawValue==1) {

TextField1.presence="visible";

} else {if (CheckBox1.rawValue ==0)

TextField1.presence="hidden";

}



You used value instead of rawValue. By the way, make sure you use javascript, not formcalc. see if this helps.

Avatar

Former Community Member
Thanks Daniel,



I already tried the same code. value and rawValue works both for showing the textbox. But with both of them I cannot uncheck the checkbox

Avatar

Former Community Member
Strange, it works fine with my form. Are you using LiveCycle Desiger or Acrobat? What version?

Avatar

Former Community Member
I use Designer 8.1 and Acrobat Reader 8.1.2



what for event do you use?

Avatar

Former Community Member
Make sure that you are saving the form as dynamic. In the saveAs dialog there is a drop down that allows you to save the PDF as a type.

Avatar

Former Community Member
It works now. I had = instead of ==



with this it works



if (checkbox1.rawvalue ==0) {

textfield1.presence="hidden";

} else if (checkbox1.rawvalue ==1) {

textfield1.presence="visible";

}

Avatar

Former Community Member
Hi,

I am having trouble with the alignment of my check boxes. I have almost a whole page of check boxes but I cannot figure out how to align the boxes, vertically, horizontally, left, right and to each other. I tried the alignment option and it only allows one action. This is the first time I have used LiveCycle. Can anyone help me?

Thanks in advance,

Patty

Avatar

Former Community Member
You can pick multiple objects that you want to align together. Lets say we want to alig a number of objects to the left edge. We can put one exactly where we want. Then select all others that you want to align and with the last selection choose the one that is aligned (this will be the object that all others are based off of). Then click on the Layout/Align/Left option and all objects that were chosen will align with the last selected object. Now repeat for the other dimensions that you want.