Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

subform instance problem

Avatar

Former Community Member
I have a subform and it has two radio buttons based on radio button selection I make some fields invisible but when I create a new instance of subform and make a radio button selection on this new instance of subform it doesn't hide the fields in this new instance of subform but hides the field in the first subform. I think I need to use index of the subform but not sure how. Any help will be highly appreciated.



Thanks



Anu
11 Replies

Avatar

Former Community Member
What's your script look like?



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
here is the script

if(this.rawValue=="1")

{

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.Company.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblCompany.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblLastName.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblMiddleName.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblFirstName.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.LastName.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.FirstName.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.MiddleName.presence="visible";

}

else//if(this.rawValue=="2")

{

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.Company.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblCompany.presence="visible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblLastName.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblMiddleName.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.lblFirstName.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.LastName.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.FirstName.presence="invisible";

BodyPage_2.subformPersonHasMoreThanTenPercentFinInt.AddName.MiddleName.presence="invisible";



}

Avatar

Former Community Member
Chris, Is it possible to attach the form in this post for your view?

Avatar

Former Community Member
No, unfortunately it's impossible to add attachments to posts in this forum without special permissions :(



So it looks like your problem is that you are fully pathing to your fields and since you aren't specifying an index for the subform it will always affect the first one. You should use relative pathing that starts from the parent that contains the radio buttons. So for example, if the radio buttons are inside AddName your script would like:



Company.presence="visible";

lblCompany.presence="visible";

etc



This way you are starting from the proper instance of the subform and it will affect the fields you want.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Thanks Chris, That worked but I have an existing issue with radio buttons, when I click on radio button first time it doesn't show as selected but when I click again on the same it gets displayed as selected is this an existing bug? Also I have my radio buttons displayed as check boxed but when I click on these radio buttons the selection shows up as dot not as tick mark. How can I change the appearance from "dot" to "tick"

Avatar

Former Community Member
Anu,

You could simplify this code if you simply set the presence of the "AddName" subform to visible/invisible. This will show or hide all of the fields in that subform. If there are other things in the subform that you don't want to hide, then you could wrap all of the above fields in a subform by themselves and then set that subform to visible/invisible.



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Thanks Justin, But I have this subform repeated all over my form and has lot other information. I can follow the approach of having separate subform but in that case I'll have to create lot of different subforms and these subforms are based on my xml. I really appreciate your help.

Avatar

Former Community Member
If you set the binding of the new subform to 'none', then it will not appear in the XML.



--

Justin Klei

Cardinal Solutions Group

www.cardinalsolutions.com

Avatar

Former Community Member
Actually I have to bind everything on my form to xml except some text content.



Thanks

Anu

Avatar

Former Community Member
> when I click on radio button first time it doesn't show as selected

> but when I click again on the same it gets displayed as selected is

> this an existing bug



Not that I know of. Out of curiosity if you remove the script, does that still happen?



Chris

Adobe Enterprise Developer Support