These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Radio button isn't checked after "click" event

Float
Registered: Aug 15 2008
Posts: 20
Answered

I do have a form with two seperate subforms. There are also two radio buttons (called "int" and "ext") at the master page. The radio buttons are grouped into an option field.

There is an script in the radio buttons which controls the presence of the two subforms. If radio button "int" is clicked subform "Tform1_int" has to be visible, if radio button "ext" is clicked "Thorm1_ext" has to be visible.

The scripts works as it should but every time a radio button is clicked and the script runs the radio button isn't checked afterwards. And of course the radio button has to be checked so the user knows which subform is shown.

The script for the radio button option list "click" event:

if (this.rawValue == "int"){
	this.resolveNode("App.Tform1_int").presence = "visible";
	this.resolveNode("App.Tform2_ext").presence = "hidden";	
}
else if (this.rawValue == "ext"){
	this.resolveNode("App.Tform1_int").presence = "hidden;
	this.resolveNode("App.Tform2_ext").presence = "visible";
}

Any ideas for this problem?

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you script is faulty.
There is no "else if" command in JavaScript.
You either use "else" or "if( )".

if (this.rawValue == "int"){xfa.resolveNode("App.Tform1_int").presence = "visible";xfa.resolveNode("App.Tform2_ext").presence = "hidden";}else{xfa.resolveNode("App.Tform1_int").presence = "hidden";xfa.resolveNode("App.Tform2_ext").presence = "visible";}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Float
Registered: Aug 15 2008
Posts: 20
Hi radzmar,

i've changed my code to your suggestion, but the effect is the same. The presence of the subforms is changing when the radio buttons are clicked but they are not checked though.
Float
Registered: Aug 15 2008
Posts: 20
Please see attached form to have a view on my problem https://acrobat.com/#d=rtyuwmibQHZR1*VI8HeAYw.

It seems to me that the problem is linked to the "presence" statement, because a couple of other statements which i've tested with the subforms worked without any problems regarding the checked status of the radio buttons.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Sorry, can you check your URL?! This URL cannot be found on Acrobat.com.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Float
Registered: Aug 15 2008
Posts: 20
Once again, i hope this link works

https://acrobat.com/?i=Wdcjga3DnFDVrwVaYQCjZw
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
It appears to be a binding problem. Since the buttons appear on a master page, they are copied onto each subform as a new instance of the button, so clicking on the button brings up a different copy of the button that is assumed to be independent of the other copies, unless one makes the binding "global".

George Kaiser

Float
Registered: Aug 15 2008
Posts: 20
gkaiseril wrote:
It appears to be a binding problem. Since the buttons appear on a master page, they are copied onto each subform as a new instance of the button, so clicking on the button brings up a different copy of the button that is assumed to be independent of the other copies, unless one makes the binding "global".
How can i make the binding global?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

George is right. You're fields binding need to be set to "global".
Select the radio buttons on the masterpage, go to the object tab > binding and set the binding from "none" to "global".

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Float
Registered: Aug 15 2008
Posts: 20
Thanks a lot guys, problem solved everthing works fine now. :)