How do I clear a drop down list?

662 views
Skip to first unread message

pat...@gmail.com

unread,
Feb 6, 2008, 6:46:12 PM2/6/08
to Adobe LiveCycle Developers
How do I clear a drop down list completely so that even if I had
selected one of its values, everything goes away including the
selected item?
Thanks,
Daniel

fred.pantalone

unread,
Feb 7, 2008, 10:46:35 AM2/7/08
to Adobe LiveCycle Developers
It's not completely clear to me what you mean by "clear a drop down
list completely". This could mean two things:

1) Remove all items from the list and de-select any currently selected
item;
2) De-select any currently selected item.

This is how you accomplish both (using JavaScript):

DropDownList1.clearItems(); // this removes all items from the drop
down list. Nothing will be selectable until you add new items (RTFM
for this) ;)
DropDownList1.rawValue = ""; // this simply deselects any currently
selected value. The items will remain selectable in the drop down list

N.B. Calling clearItems() alone does not clear from the list any
currently selected item. You include both lines of code to fully
accomplish 1).

Fred
Reply all
Reply to author
Forward
0 new messages