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

Radio button reset subform

emaier
Registered: Dec 22 2010
Posts: 4
Answered

Hi,
 
I have two radio buttons: radioA & radioB. I want each radio button to reset the values of a different subform and remain marked with an "x".
 
Only focusing on radioA right now -
 
I've tried lots of different code (I'm a newbie and teaching myself). I have a code that resets the subform properly, but after the subform has been reset, the radio button remains empty (no "x").
 
My code on radioA: xfa.host.resetData("xfa.form.form1.Sec2BSubForm") where Sec2ASubForm is the subform I want cleared.
 
Binding is set to global, Acro 7 dynamic form, and all the related subforms are grouped within the same subform:
Sec2
Sec2RadioButtonList
radioA
radioB
Sec2ASubForm
Sec2BSubForm
  
Basically, I want each radio button to clear the opposite subform while retaining an "x".
 
I'm not sure how to do that. Any help woudl be appreciated.
 
Thanks.
 
Eric

My Product Information:
LiveCycle Designer, Windows
emaier
Registered: Dec 22 2010
Posts: 4
Whoops! make that:

My code on radioA: xfa.host.resetData("xfa.form.form1.Sec2BSubForm") where Sec2BSubForm (not "A") is the subform I want cleared.
Niall
Expert
Registered: Apr 26 2006
Posts: 62
Hi,

I am assuming that both radio buttons are grouped, so that the user can only select A or B. Is this the case or can the user select both at the same time?

If they are mutually exclusive then radio buttons are the best option. However if you want the user to be able to select/tick both at the same time, then two checkboxes would work better.

On the basis of radio buttons, I would place the script in the click event of the radio button GROUP. You can select this in the hierarchy. If radioA has a bound value of 1 and radioB has a bound value of 2 (see the Object > Binding palette), then the following Javascript in the click event should work for you....
if  (this.rawValue == "1") // A clicked{xfa.host.resetData("xfa.form.form1.Sec2BSubForm");}else{xfa.host.resetData("xfa.form.form1.Sec2ASubForm");}
Make sure the radio button group is not in either of the subforms and that the bound values for the radio buttons are different (eg in the Object > Binding palette that both are not set to "1".

Hope this helps,

Niall
Assure Dynamics

emaier
Registered: Dec 22 2010
Posts: 4
Thanks, Niall.

Okay. I understand what your code should do, but something is still not working correctly. I set the code you provided on the click event on the subform/exclusion group (the radio selections do need to be mutually exclusive, btw). Now, both subforms clear at the same time regardless of which radio button is clicked, and neither button retains an "x". I alternately tried putting it on the change event with the same results.

Here's the hierarchy:

topmostsubform
...Page1
......Sec2RadioButtonList
.........radioA (binding= global, "1")
.........radioB (binding= global, "2")
......Sec2ASubForm
.........(various fields= checkbox, text, numeric)
......Sec2BSubForm
.........(various fields= radio_group#2, text, numeric)


Thanks again!




Niall
Expert
Registered: Apr 26 2006
Posts: 62
Accepted Answer
Hi,

It may be that you have a global binding on the radio buttons, but I would expect that to have be the issue unless you have some other script going on.

Also the form was created by importing either a Word or PDF. Again I wouldn't have expected this to be the issue.

Here is a sample, which may be of help: http://www.assuredynamics.com/index.php/category/portfolio/resetting-fields/

Happy holidays!

Hope this helps,

Niall
Assure Dynamics

emaier
Registered: Dec 22 2010
Posts: 4
Hi, Niall,

I apologize for taking so long to get back - the holidays and all.

After examining the code in the Assure Dynamcis PDF you supplied, I ended up using the SomExpression example (tweaked for my form) and it worked perfectly. Thank you so much for all your help.

Eric