Checkbox help
hi,
i using javascript within pdf make form simpler use. have checkbox list sub-checkbox list within (see below)
when filling in form need user able check 1 item primary list , further item if chekc box sublist.
i have been able achieve using following document level code , mouse - run javascript option.
function cbcontrol()
{
var f1 = getfield("eligible activity 1"); (area benefit checkbox above)
var f2 = getfield("eligible activity 2"); (limited clientle checkbox)
var f3 = getfield("eligible activity 3"); (housing checkbox above)
var f4 = getfield("eligible activity 4"); (jobs checkbox above)
var f5 = getfield("lcb sublist 1"); (project activity maintains client records checkbox above)
var f6 = getfield("lcb sublist 2"); (project activity has income eligiblity checkbox above)
var f7 = getfield("lcb sublist 3"); (project activity of such nautre checkbox above)
var f8 = getfield("lcb sublist 4"); (project activity clients presumed checkbox above)
if (event.target === f1) {
f2.value = "off";
f3.value = "off";
f4.value = "off";
f5.value = "off";
f6.value = "off";
f7.value = "off";
f8.value = "off";
return;
}
if (event.target === f2) {
f1.value = "off";
f3.value = "off";
f4.value = "off";
return;
}
if (event.target === f3) {
f1.value = "off";
f2.value = "off";
f4.value = "off";
f5.value = "off";
f6.value = "off";
f7.value = "off";
f8.value = "off";
return;
}
if (event.target === f4) {
f1.value = "off";
f2.value = "off";
f3.value = "off";
f5.value = "off";
f6.value = "off";
f7.value = "off";
f8.value = "off";
return;
}
function sublistcontrol()
{
var f1 = getfield("eligible activity 1");
var f2 = getfield("eligible activity 2");
var f3 = getfield("eligible activity 3");
var f4 = getfield("eligible activity 4");
var f5 = getfield("lcb sublist 1");
var f6 = getfield("lcb sublist 2");
var f7 = getfield("lcb sublist 3");
var f8 = getfield("lcb sublist 4");
if (event.target === f5) {
f1.value = "off";
f3.value = "off";
f4.value = "off";
f6.value = "off";
f7.value = "off";
f8.value = "off";
return;
}
if (event.target === f6) {
f1.value = "off";
f3.value = "off";
f4.value = "off";
f5.value = "off";
f7.value = "off";
f8.value = "off";
return;
}
if (event.target === f7) {
f1.value = "off";
f3.value = "off";
f4.value = "off";
f5.value = "off";
f6.value = "off";
f8.value = "off";
return;
}
if (event.target === f8) {
f1.value = "off";
f3.value = "off";
f4.value = "off";
f5.value = "off";
f6.value = "off";
f7.value = "off";
return;
}
}
however no matter try, can not 'eligible activity 2' box check if 1 selects 1 of sublists checkboxes. have tried including follwoing sublistcontrol code
if (event.target === f5) {
f1.value = "off";
f2.value = "on"; (also tried f2.value = "yes";)
f3.value = "off";
f4.value = "off";
f6.value = "off";
f7.value = "off";
f8.value = "off";
return;
but not work. can suggest solution??
kind regards
rhys
you need use export value of box, although better way use checkthisbox() method, so:
f2.checkthisbox(0,true);
More discussions in JavaScript
adobe
Comments
Post a Comment