Expand my Community achievements bar.

How to delete an item from the addItem list after it is entered in a field

Avatar

Former Community Member

I have a form which contains a list of names. My problem is, I would like the form to remove a name after it is entered so that on the next row that name does not appear. For example, I have on the preopen event:

Name.addItem("Andrew")

Name.addItem("Bernie")

Name.addItem("Chris")

Name.addItem("Doug")

and I select  'Bernie", I would like the next row to only have 3 names excluding the one I previously selected. And in the end, it should have no names if all four names have been selected, or should display a message.

Is it possible to do this in LC. either in javascript or Formcalc.

Thanks.

2 Replies

Avatar

Level 9

Hi,

Here is sample form for you. See the scripts in the docReady and in the exit events of the fields.

https://acrobat.com/#d=7DBfckzPnXt1RDK7aYebaA

Thanks,

Bibhu.

Avatar

Former Community Member

I have checked the above example and it works perfectly for static fields. My problem is that the form I am using using employs the addinstance script to add new rows. How do you script for the new rows to not include names that have already been selected.

In the example, I would like for new rows to exclude names that have previously been selected.

sample.jpg

Thanks.