These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Deselecting Radio Buttons

Terrill
Registered: May 4 2007
Posts: 14

Thom,
 
Saw where someone wanted the ability to "deselect radio buttons." Here's a little ditty that you may find useful...
 
Given: Two radio buttons named rad, which of course form a group. One for "Yes," and the other for "No." We'll nickname them rad-Yes and rad-No.
 
On the 1st button (rad-Yes), set the actions as follows:
 
Mouse Down:
this.getField("rad").OldValue = this.getField("rad").value;
 
MouseUp:
if (this.getField("rad").OldValue == "Yes") {
this.getField("rad").value = "Off";
}
 
On the 2nd button (rad-No), set the actions as:
 
Mouse Down:
this.getField("rad").OldValue = this.getField("rad").value;
 
Mouse Up:
if (this.getField("rad").OldValue == "No") {
this.getField("rad").value = "Off";
}
 
This takes advantage of the fact you can arbitrarily create properties on objects, and then forms a toggle for each radio button.
 
Enjoy!
 
-- Terrill --
(PS: Seems the sat-still-lite (satellite) is acting up today. If you've seen this twice... it's because things died last submission!)

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Actually it's much easier than this. The trick is to use check boxes like radio buttons. Just name them the same and provide different export values

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Terrill
Registered: May 4 2007
Posts: 14
Except that [url=http://www.acrobatusers.com/forums/ask_an_expert/questions/view/356/]the original question[/url] was "I want my user to be able to deselect the radio button if they want to if a mistake was made. How do I accomplish this?"

And the answer provided was "Radio buttons cannot be deselected once the button is selected and checkboxes don't have a circle for the appearance."

My example demonstrates that "Radio buttons [b]can[/b] be deselected," if what you want is one or more Radio Buttons with all of their usual attributes, and [b]not[/b] Checkboxes.
juliel
Registered: Dec 30 2009
Posts: 15
Has anyone figured out yet how to deselect a radio button on a form in Acrobat 9.0?
Please do not suggest using check boxes instead of radion buttons. There has to be a way to unclick a button that has been clicked on either by setting something in the properties dialogue box or by running a java script. I've been searching for days and have tested various scripts and have not found one that works.

Please help me.

Thanks!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Mr. Terril already answered your question in his first post. But I went ahead and answered it in your other thread. Please do copy the same post to different threads.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script