Hey guys, I've been reading these forums for a while, and they have been awesome at helping me to find answers to my questions up until now. I'm getting to the point where I have questions that I don't think have been previously asked!
So, I'm making a form for my work which will be a way of filling out data online. I'm using existing PDFs that I am just adding form fields to. The way it needs to be set up is: I have 6 checkboxes set up on line 1 of the form operating as radio buttons so they are mutually exclusive. The user can only select one of the 6 checkboxes and depending on which they select, different fields appear/hide on the lines below that. I have all that functionality working. Javascripts tied to the 6 checkboxe's 'Mouse Up' events control the display/hiding of all the other fields depending on which checkbox has been selected.
But now I have just been informed that the checkboxes not only need to be mutually exclusive, they also need to be deselectable. I set up this functionality using a global variable to store the old value of the checkbox, and when the user clicks on another checkbox it compares the new value of the checkbox with the old value. If they are the same, it uses a this.getField("foo").value = "Off" code to deselect the check box. This correctly makes the checkboxes deselectable while still being mutually exclusive.
The only problem with this is that the fields on the lines below do have their display value modified, because a mouse up event has not been triggered by changing the value. I need to make these other fields always change depending on which checkbox is selected on line one, or hide all of them if no checkbox has been selected.
Could I use the global variable subscribe function to do this? Or is there a way to make radio buttons deselectable while still mutually exclusive? I don't mind rewriting code to replace what I already have, but I do have the requirement that this form needs to run fast, so I want to make optimal javascript. Any ideas about the right way to approach this?
Thanks in advance!
-Tyler
In the Mouse Up event of each check box you would place code to reset and activate/deactivate the other fields associated with the check box group.
I don't see a need for using global variables for any of this.
George