Highlighted

Checkboxes

Avatar

Guest

28-07-2008

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

Replies

Highlighted

pguerett

28-07-2008

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).
Highlighted

Avatar

Guest

29-07-2008

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.
Highlighted

pguerett

29-07-2008

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";

}

}
Highlighted

Avatar

Guest

30-07-2008

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?
Highlighted

pguerett

30-07-2008

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

Avatar

Guest

31-07-2008

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";

}
Highlighted

Avatar

Guest

31-07-2008

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.
Highlighted

Avatar

Guest

31-07-2008

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