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.

  • 4
    $\begingroup$ 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." $\endgroup$
    – Szabolcs
    Jan 31, 2013 at 14:37

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

  • $\begingroup$ 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?! $\endgroup$
    – perlt
    Jan 31, 2013 at 19:44
  • $\begingroup$ @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. $\endgroup$
    – Michael E2
    Feb 1, 2013 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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