Script to finds and delete blank items in ListBox list

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

20-03-2015

My form has some items added to a ListBox by the form user.

I need a script that will loop through the ListBox list, find and delete any items that display as blank (can click in that row but no text is displayed).

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

jasotastic81

Avatar

jasotastic81

jasotastic81

20-03-2015

You may need to modify this a little to suit your purposes: It doesn't catch list items with a blank space.


var lbList = xfa.resolveNode("lbStuff.#items");


for (i = lbStuff.length-1; i>=0; i--){


if (lbList.nodes.item(i).value == "") lbStuff.deleteItem(i);


}



I tested with a list box "lbStuff" that contained "15", "", " ", and "16" as values. This script removed the "", but left the " ". So if it is possible for the user to add an item with spaces and no text, it will need to be modified a little.

Answers (1)

Answers (1)

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

23-03-2015

As far as I can tell, your script solved my problem.

Thank you so very much for your help!