Creating a list of PopupMenus that dynamically update an element in a list

So as the title says I am trying to make a list where each element is determined by a users choice of an element in a PopupMenu.

My first attempt:

test = Table["A", {5}];
Table[PopupMenu[Dynamic[test[[n]]], {"A", "B", "C"}], {n, 5}]


Returned the following error

Part::pspec: Part specification n is neither an integer nor a list of integers.


For some reason the dynamic(?) would not allow me to refer to specific elements in the list. I then tried to circumvent this issue by introducing an extra variable temp:

Table[temp = n;PopupMenu[Dynamic[test[[temp]]], {"A", "B", "C"}], {n, 5}]


However, all this did was create 5 PopupMenus that all referred to the $5^{\text{th}}$ element of the list test. I tried to put a Setting[] around the Dynamic[], but since that removes that effect of Dynamic[] nothing happened at all.

Any suggestions would be greatly appreciated.

-

This seems to work :

test = Table["A", {5}];

PopupMenu[Dynamic[test[[#]]], {"A", "B", "C"}, "A"] & /@ Range[5] // Row

Dynamic @ test

(* {"C", "A", "B", "A", "C"} *)

-
Thanks! That was exactly what I was looking for. –  E.O. Aug 4 '12 at 11:36

You can also use:

 test = Table["A", {5}];
Table[With[{n = n}, PopupMenu[Dynamic[test[[n]]], {"A", "B", "C"}]], {n, 5}]


or

 Table[PopupMenu[Dynamic[test[[k]]], {"A", "B", "C"}] /. k -> n, {n, 5}]

-
Thanks for the answer as well! Just one question though; how come the With[{n=n},.....] works? –  E.O. Aug 4 '12 at 12:33
@E.O., With[{n=n},..] is used to replace all instances of the local variable n with its corresponding value ("so that the values of the Table iterator variable are passed into the dynamic expression"). See How to Evaluate Expressions inside Dynamic or Manipulate for several examples on the reason why it is needed and works here. –  kguler Aug 4 '12 at 13:57