Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Pop-up message does not show up on the second instant

Avatar

Level 7

I have a script for a DDL on exit below. If the value of an item starts with 135, a message show up.

I have the DDL in a repeating instant. Script work for the first instant but not for the second!

What I am doing wrong? CC is the Drpo down list.

Thanks

var strNewtext = form1.Page1.ALL.Item_Sub.All_A.details.detail.CC.rawValue.toString();

if (strNewtext.length>3){

if(strNewtext.substring(0,3)=="135")

xfa.host.messageBox("This is……","CAPITAL ACCOUNT",3);

1 Accepted Solution

Avatar

Correct answer by
Level 1

You need to reference the instance specifically in order for the script to work on repeating instances.

I'm not sure about the exact layout of your form, subforms and elements, but this script works if "All_A" is the repeating subform (just change the parent.instanceIndex reference to whichever element is the repeating one)

var dropDown = "form1.Page1.ALL.Item_Sub.All_A["+parent.parent.parent.instanceIndex+"].details.detail.CC";

var strNewtext = xfa.resolveNode(dropDown).rawValue;

if (strNewtext.length>3){

    if(strNewtext.substring(0,3)=="135") {

        xfa.host.messageBox("This is……","CAPITAL ACCOUNT",3);

    }

}

View solution in original post

3 Replies

Avatar

Correct answer by
Level 1

You need to reference the instance specifically in order for the script to work on repeating instances.

I'm not sure about the exact layout of your form, subforms and elements, but this script works if "All_A" is the repeating subform (just change the parent.instanceIndex reference to whichever element is the repeating one)

var dropDown = "form1.Page1.ALL.Item_Sub.All_A["+parent.parent.parent.instanceIndex+"].details.detail.CC";

var strNewtext = xfa.resolveNode(dropDown).rawValue;

if (strNewtext.length>3){

    if(strNewtext.substring(0,3)=="135") {

        xfa.host.messageBox("This is……","CAPITAL ACCOUNT",3);

    }

}