Hi,
I have a Acrobat form with a question with 4 mutually non exclusive choices (= checkboxes cb1 to cb4) and a 'no preference' choice (cb5):
cb1 : Choice A
cb2 : Choice B
cb3 : Choice C
cb4 : Choice D
cb5 : No preference
I have little javascript knowledge, but from reading the forum, I already got the following script (which runs on 'Mouse Up') together:
// Get a reference to each check box
var f1 = getField("cb1");
var f2 = getField("cb2");
var f3 = getField("cb3");
var f4 = getField("cb4");
var f5 = getField("cb5");
// Uncheck cb5 if cb1, cb2, cb3 or cb4 was selected/deselected
if (event.target === f1 || event.target === f2 || event.target === f3 || event.target === f4) {
f5.value = "Off";
}
// Uncheck cb1, cb2, cb3 and cb4 if cb5 was selected/deselected
if (event.target === f5) {
f1.value = "Off";
f2.value = "Off";
f3.value = "Off";
f4.value = "Off";
}
Now, I'd also like to add some script which, if a user checks cb1, cb2, cb3 and cb4 (which actually means that this user has no preference), unchecks checkboxes cb1 to cb4 and checks cb5.
Any hints on how to do this would be much appreciated!
Use of the exclusionary group greatly simplifies the coding and test of radio buttons and check boxes.
The difference between radio buttons and check boxes is that once a radio button has been selected, the group can not be cleared by checking the checked button. With check boxes, one can check the selected check box and that check box will be unchecked and no other check box needs to be checked. Radio Buttons obtained their name from the old analog radios with preset buttons that always required one button to be selected and it was not easy to deselect all of the buttons at one time.
George Kaiser