Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Drop downs

Avatar

Former Community Member
I need the value of a drop down to make an invisible form visible if its value is under 5, this is the code I am using under the change function:

if(this.rawValue == 1)

{

addtl.presence = "visible";

}

else

{

addtl.presence = "invisible";

}

if(this.rawValue == 2)

{

addtl.presence = "visible";

}

else

{

addtl.presence = "invisible";

}

if(this.rawValue == 3)

{

addtl.presence = "visible";

}

else

{

addtl.presence = "invisible";

}

if(this.rawValue == 4)

{

addtl.presence = "visible";

}

else

{

addtl.presence = "invisible";

}

if(this.rawValue == 5)

{

addtl.presence = "visible";

}

else

{

addtl.presence = "invisible";

}



Can someone please tell me what is making this not work for me?
2 Replies

Avatar

Former Community Member
Let me correct myself, I need a form field within the same subform to be visible upon the selection of the numerical value in the drop down list

Avatar

Former Community Member
Hi Jaime,



Select the dropdown field, open the 'Object' window, select the 'Binding'-palette, check 'Specify Item Values'.

Then, in the dropdown's change-event enter the following JavaScript-code:






if (this.boundItem(xfa.event.newText) < 4)



    xfa.resolveNode("#subform[0].Textfield").presence = "visible";



else



    xfa.resolveNode("#subform[0].Textfield").presence = "invisible";





You may want to replace '#subform[0]' with the name of the subform your textfield is located in and 'Textfield' with the name of the Textfield in question.



Regards,

Steve