Expand my Community achievements bar.

How can I add a sub form when a check box or radio button is checked?

Avatar

Former Community Member
I'm trying to make it so a sub form is added or removed depending on which radio button or check box is selected. I don't know how. Can someone help.
5 Replies

Avatar

Former Community Member
I tried working with mouseUp event and it works but what I need to do is to be able to determine if a box is checked then one thing will happen or another will happen.

Avatar

Former Community Member
Steven,



Check out:

http://www.adobeforums.com/cgi-bin/webx?128@@.3bbedb8b



You can check the value of the radio button or check box and place the code in for that.



Catherine

Adobe Systems

Avatar

Former Community Member
Thanks for the lead. I tried looking this subject up yesterday with a search on this site but missed that one.



I had figured it out late yesterday and used the code in a calculate event but since looking at the topic you linked me to it seems better to use the change event.



I also needed to have the sub form hidden when the document is opened unless a particular radio button is selected. I put this in the initialize event and it seems to work great.



If you're still watching this one there is something else I can't figure out why it's not working.



I tried putting a button with an alert script that would get the value of a radio button list. So I put the following code in the click event of a button that resides in the same sub form as the radio button list.



var myVal = xfa.form.form1.MainPage.SecondSF.RadioButtonList.rawValue;

app.alert(myVal);



If no buttons are selected the the value us "" and if button 1 is selected then the value is "1" and so forth.



Well when I try to get the value of a radio button list in another subForm then it doesn't work.



var myVal = xfa.form.form1.MainPage.FirstSF.RadioButtonList.rawValue;



I'm not understanding what I'm doing wrong. Can you tell by the sample code what I need to do?

Avatar

Former Community Member
Steven,



I don't see anything wrong with your code by inspection. Are you naming your variables differently (myVal1 and myVal2)?



Catherine

Avatar

Former Community Member
Here is the exact code that I've finally ended up with that is not working.



var myRadioBtn = xfa.form.form1.MainPage.RadioButtonSF.RadioButtonList.rawValue;

app.alert(myRadioBtn);



The button that this is attached to is in another subForm called FirstSF. The alert comes up but with nothing in it. The radio RadioButtonList consists of a Yes and No button and the Yes button is selected.