Expand my Community achievements bar.

Unlock field-Instances

Avatar

Level 7

For a button I have the script below to unlock the field: form1.PageA.Sub_A.Table1.Item.Equipment

The type read only field above it is into repeating subform. The script works if I do not add any instances.

If I add a instance unlocks only the first field and the other remain locked!

Any suggestion?

Thanks

var

flag = false;

while

(flag != true){

var CheckPW = xfa.host.response("Password required", "PassWord", "", 0);

if (CheckPW == "123"){

form1.PageA.Sub_A.Table1.Item.Equipment.access = "";

flag = true;

}

else {

if (CheckPW == ""){

flag = true;

} else {

xfa.host.messageBox("Wrong Password, please try again!", "",0,0);

}

}

1 Reply

Avatar

Level 10

form1.PageA.Sub_A.Table1.Item.Equipment.access

The above line always refers to the first instance of the Subfiorm.

If you add instances at runtime you need to pass the index to the Subform name so that it refers to the field in the correct instance.

For example:

     Assuming Sub_A is repeating at runtime, then

     form1.PageA.Sub_A[1].Table1.Item.Equipment.access

    

     form1.PageA.Sub_A[2].Table1.Item.Equipment.access

Thanks

Srini