Quitter
  • Communauté internationale
    • Langue:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Can you deselect a radio button?

Nouveau ici ,
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
Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
1 SOLUTION APPROUVÉE
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.

Voir la solution dans l'envoi d'origine

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
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.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Nouveau ici ,
Jan 04, 2010 Jan 04, 2010

Thanks Try67...I appreciate your help

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Engagé ,
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

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Nouveau ici ,
Jan 04, 2010 Jan 04, 2010

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

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
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.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
LÉGENDE ,
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.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
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.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
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.

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
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

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
Sep 07, 2010 Sep 07, 2010
LA PLUS RÉCENTE


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;
};
}();
Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines