Skip to main content
New Participant
January 4, 2010
Answered

Can you deselect a radio button?

  • January 4, 2010
  • 2 replies
  • 29417 views

Hi, I am a forms designer and have recently been asked to make one of my client's forms fillable.  I have purchased Adobe 9 Pro and everything was going quite well until I ran into an area that requires radio buttons.

It would seem that once a radio button is selected, it cannot be deselected, you can only move from one radio button to another.

Can anyone tell me how to deselect radio buttons or if it is even possible?

Thanks!

    This topic has been closed for replies.
    Correct answer try67

    You can reset the form, but then you will lose all the data in it.

    If a radio button needs to be deselected, it should probably be a check-box.

    2 replies

    DimitriM
    Inspiring
    January 4, 2010

    Hi highviewgb,

    You can have a set of checkboxes that act as a radio button group.  Here is an article on that-

    http://www.acrobatusers.com/tutorials/creating-radio-checkboxes

    Another possibility often used is to add a radio button for "none" in the group in case a choice is made and then the user decides it is not correct.

    Hope this helps,

    Dimitri

    WindJack Solutions

    www.pdfscripting.com

    www.windjack.com

    March 5, 2010

    Hello,

    sorry for reopenning topic.

    I also needed to deselect radio-buttons and I found this thread while I was searching forum.

    I wrote function inspired by article from DimitriM's link and I would like to share it with those, who will search it in future.

    Tested in AR 9.3 and 8.0.

    //1. I have this in script object called eg "foo"

    var rbs = new Object();

    function handleRBClick(o)
    {
        if (rbs[o.name]==null)
        {
            rbs[o.name]=o.rawValue;
        }
        else{
            if (rbs[o.name]    == o.rawValue)
            {
                o.selectedMember().rawValue = 0;
                o.execEvent('change');
            }
            rbs[o.name]    = o.rawValue;
        }
    }

    //2. then add following to your radio-button's group click() event

    foo.handleRBClick(this);

    //so it needs one handleRBClick call for each radio-button group, but it is still better then placing it to each group item.

    September 6, 2010

    Nice scripting Radek.

    I took the liberty of evolving foo into the following:

    var rbs = new Object();

    function handleRBClick(o) {
    if (rbs[o.name] == o.rawValue) {
      o.selectedMember().rawValue = null;
    }
    rbs[o.name] = o.rawValue;
    }

    Also, you might want to add the call foo.handleRBClick(this) to the exclGroup's init-event in order to handle opening data files.

    try67
    try67Correct answer
    Community Expert
    January 4, 2010

    You can reset the form, but then you will lose all the data in it.

    If a radio button needs to be deselected, it should probably be a check-box.

    New Participant
    January 4, 2010

    Thanks Try67...I appreciate your help