Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Resetting Radio Buttons

Avatar

Level 1

Hi all,

I've been reasearching a way to do this and have found some scripts that aren't working.

Ive got 6 radio buttons, one labeled as Reset.  I've tried several different scripts but each one clears the entire form, even if I am adding the script just to the Reset button of the group. 

I am self taught and have never worked with scripts before but I feel like I am close and doing something very basic wrong. 

Please help!

Thank you!

5 Replies

Avatar

Level 1

I dont understand what you mean by checking - sorry to be so lame but I really am a self taught and have never worked with javascript.  What I did was copy and paste some scipts that I found (I should have kept them as exampes) and edited the name of the script to the name of my radiobutton list, which it said to do. 

I guess what I am asking is this:

Is there a standard easily editable script that will allow one to clear a selected radio button in a set such that one radio button is labled reset, or something to that effect. 

My form has a question that doesn't need to be answered and I dont even want to try to get into hidding fields. My easy fix is having the question that won't apply to everyone but someone might accidently select a radio button in that question that can't be cleared. 

Thank you all for your attempt to help me with this!

Avatar

Level 2

There is a function called resetData().  Look it up in the help.  That function resets data, as it says, clearing text fields, dropdowns, but also resets radiobuttons.

Avatar

Level 4

When you say "reset" Do you really just want to unselect all the items in a radio button group?

This little bit of script in the click event of the group will uncheck the radio button when the shift key is held down at the same time you click the radio again.

if (xfa.event.shift)

{

this.rawValue = "";

}

 

Now that is not very intuitive for a user to know how to uncheck so I added some text in the tooltip section under the Accessibilty palette.

Similar to "

 

To clear selection, press and hold the SHIFT key and re-click your selection.

Avatar

Level 1

This is what I use, it doesn't give you a button to reset all but rather is applied to each button and then allows you to simply click again to recycle the button status

Javascript

   

Mouse-Down Action Script to capture initial state

  this.initValue = this.rawValue;

Mouse-Up Action Script to turn off radio button

var localExport = null;

for(var i=0;i<this.nodes.length;i++)

{

   if(this.nodes.item(i).className == "items")

   {

       localExport = this.nodes.item(i).nodes.item(0).value;

       break;

   }

}

if(this.initValue == localExport )

   this.rawValue = 0;