Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can you deselect a radio button?

New Here ,
Jan 04, 2010 Jan 04, 2010

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!

29.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 04, 2010 Jan 04, 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.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2010 Jan 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 04, 2010 Jan 04, 2010

Thanks Try67...I appreciate your help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 04, 2010 Jan 04, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 04, 2010 Jan 04, 2010

Dimitri, that is exactly what I was looking for....thank you so much!!!!!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 05, 2010 Mar 05, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 05, 2010 Mar 05, 2010

Is your code looks like it for a form created using LiveCycle Designer and can not be used in forms created with Acrobat's form tools. Acrobat JavaScript does not have a property of ".rawValue".

LiveCycle Designer is a different program than Acrobat and uses different JavaScript language syntax and also has a additional scripting language, FormCalc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 05, 2010 Mar 05, 2010

You are right GKaiseril, I unfortunately noticed it now, it should be for LiveCycle forms thread.

Sorry. If there are moderators, it can be deleted.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 06, 2010 Sep 06, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 06, 2010 Sep 06, 2010

Nice modification c@tc.se ( I feel a bit embarrassed, I usually do not write this redundancy 🙂 )

I do not remember, why exactly I needed to force the execEvent('change'), but It may not work properly without it.

Thanks for posting.

radek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 07, 2010 Sep 07, 2010
LATEST


Nice modification c@tc.se ( I feel a bit embarrassed, I usually do not write this redundancy 🙂 )


Don't! 😆

I had to go make a diagram of your if-statements in order to spot ways to optimize it.

I went through lengths trying to solve the problem using no scripting at all; I figure text field events contain the states of the field before and after the change. However check buttons seem to be a different story.

I thought the line:

     if (rbs[o.name] == o.rawValue)

would yield an exception the first time (addressing an undeclared array index). For some reason it doesn't.

Anyway, here's an improved, encapsulated, singletonish, namespace-aware version:

var handleRBClick = function() {
var rbs = new Object();
return function(o) {
  if (rbs[o.name] == o.rawValue) {
   o.selectedMember().rawValue = null;
  }
  rbs[o.name] = o.rawValue;
};
}();
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines