Expand my Community achievements bar.

SOLVED

How to clear a choice in a radiobutton group!

Avatar

Level 2

Hi

I have a form where there are a Radio Button group with 2 buttons. After checking the one or the other button, i cant reset the buttons, so that neither button one or button two are selected. The user has checked one of the buttons, and decide that neither button one nor button two should be checked, how dos the user clear the checkmarks?

Im a novice in using Live Cycle, and the English language to. :-)

Hope some one dos have a solution for this issue.

1 Accepted Solution

Avatar

Correct answer by
Level 6

3 buttons:  YES - NO - CLEAR.

Script is on the CLEAR button.

In design mode, click on the CLEAR button and in the scripting

window enter:    xfa.host.resetData("RadioButtonGroup Name");.

Use Java Script and select "click" from Event drop down

View solution in original post

12 Replies

Avatar

Level 2

Hi

I'm a totaly newbe to LiveCycle, so I don't know how to use, nor where to set in "xfa.host.resetData("form1.subform1.favouriteFoodGroup");"?

I understand that it's a sort of code, taht must be set in somewhere, please explane a bit more detailed. And how dos the user activate the funktion?

Avatar

Correct answer by
Level 6

3 buttons:  YES - NO - CLEAR.

Script is on the CLEAR button.

In design mode, click on the CLEAR button and in the scripting

window enter:    xfa.host.resetData("RadioButtonGroup Name");.

Use Java Script and select "click" from Event drop down

Avatar

Level 2

Hi

I had hoped there was a possibility to do it only with the 2 buttons. Fore examble if therer was cklicked on a button, that allready is marked with a cross, then the cross should be removed. Is this a possibillity or not?

I could imagine a solution code, something like "on click if 'checked' uncheck" :-)

Avatar

Level 2

Hi

I have chosen to make a reset button not included in the "Yes - No" group, and used the script you advised me to, and it works fin. The reset button is set to 'invisible', so that the button only is visible in the form, when the 'Highlite Fields' option is chosen, and not in the printed version af the form.

Thanks for your help.

Avatar

Level 2

Hi

Sorry! I was too guick to give a possitiv respons on the answerd. I now have found out that every click on a random reset button, resets all my radiobutton groups. Have do i solve this new issue?

I think i have made all correct, but i'm not shure.

Kind Regards Per Krog

Avatar

Level 6

Add  a little to the script:

xfa.host.resetData("form1.Subform1.RadioButtonListName");

Avatar

Level 2

Hi

Sorry, I don't quite understand what you mean?

I think "form1" should be the filename of the form? But what is the "Subform1" part of the title?

Or is is usefull just to name the script exsakte as you have written it?

Should everey single script have a different name/tittle?

Thank you for your patience. ;-)

Kindly Per Krog

Avatar

Level 6

With your form open, look in the hierarchy.

Top item:  Form1

Now identify the subform that contains your radio button list

Designer defaults to:   (untitled Subform) (page1) -In my example I re-named it Subform1

Now identify the name of your radio button list

Plug those into the script

Avatar

Level 2

Hi

At the top of the hierarchy there is an ikon named TopmostSubform, is this what i have to use insted of (untitled Subform) in your examble?

I have a Radio Button Group named >GasMangSikJaNej<, I assume the syntax must be like this:

>xfa.host.resetData("topmostSubform.Page1.GasMangSikJaNej");<

Is this correct?

Per Krog

PS. I'm using LiveCycle Designer version 8.0.1291.1.339988, just for info.

Hi

Now i think I've got the understanding of, how it has to work.

I have a Radio Button Group named >GasMangSikJaNej<, and a resetbutton named >GasMangelReset<.

Then in the Javascript I has enteret the following script:

>xfa.host.resetData("topmostSubform.Page1.GasMangSikJaNej");xfa.host.resetData("topmostSubform.Page1.GasMangelReset")<

The first part >xfa.host.resetData("topmostSubform.Page1.GasMangSikJaNej");<, resets the button group >GasMangSikJaNej<,

and the last part >xfa.host.resetData("topmostSubform.Page1.GasMangelReset")<, resets the reset button.

If the last part is omitted, there will be set a cross/square in the ResetButton, I think it's because the reset button isn't included in the buttonGroup. I find this solution nice, because the reset button isn't visible, without if the "high light fields" setting is on. The reset button is set to Presence: Visible (Screen Only).

Thank you for all your patience and helpfull input on this issue.

Message was edited by: PerHKrog

Avatar

Level 6

Glad it worked for you.  Builds your confidence with the software when you can get it to work.

Avatar

Level 5

I realize this is an old post, but for future readers....

An easier way to do this is to create two checkboxes, and set them to "Circle" type.

In the "Click" event for CheckBox1, add this script:


if (this.rawValue == 1) {


    CheckBox2 = 0


}


In the "Click" event for CheckBox2, add this script:


if (this.rawValue == 1) {


    CheckBox1 = 0


}


While they will not appear as a single object in the Heirarchy (as a radio button group normally would), this setup will allow you to have them as mutually exclusive, and at the same time allow you to de-select an active button so you can have both clear.

Hope this helps someone!