Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to work with lists within the CDF player. A very simple example, which works inside a notebook is

DynamicModule[{x = {1, 2, 7}}, 
 Panel[Column@{InputField[Dynamic@x, Expression], Dynamic@func@x}], 
 Initialization :> (func[x_] := 2*ToExpression[x])]

Exported as a stand alone CDF application this does not work. Changing input x results in nothing!

If x is a Number then it works also in the CDF player.

share|improve this question
From wolfram.com/cdf/faq/details-for-mathematica-programmers.html : "Non-numeric input fields are not supported. Avoid InputField[x, String] and InputField[x, Boxes]. InputField[x, Expression] and InputField[x] are restricted to work only with numbers, and InputField[x, Number] works normally." –  Szabolcs Jan 31 '13 at 14:37
add comment

1 Answer 1

If you only need to input lists of numbers, you can use a single InputField to select the length and generate one InputField per entry:

DynamicModule[{a = {0, 0, 0, 0, 0}, m = 5},

  InputField[Dynamic[m], Expression, ImageSize -> 40],
     Dynamic@Table[With[{i = i}, 
        InputField[Dynamic[a[[i]]], ImageSize -> 30]]
     , {i, 1, m}]
   , If[Length@a =!= Round@m, a = PadRight[a[[1 ;; Min[m, Length[a]]]], m]]]
 }], Dynamic[a]}

Now the user can change the length of the list, and the elements of it:

The resulting interactive list generator

share|improve this answer
Thank you for your advice. But mostly I would need a list of tuples or so. E.g. {{a,b,2},{r,f,3},...} I think this would be rather difficult to realize?! –  perlt Jan 31 '13 at 19:44
@perit Your example ("E.g.") contains nonnumeric expressions (a, b, r, f) which are not supported, no matter how one tries to program the ability to enter the components of lists. –  Michael E2 Feb 1 '13 at 3:43
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.