Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am storing the values from xlData to the result in a Grid form. I want when I change any of the value in any of the InputFields, it should show the change dynamically when I evaluate result again. I have to use this result variable again in my code. How can I do this?

   result = {};   
   xlData = {{1, "a", "b", "c"}, {2, "d", "e", "f"}};
   For[i = 1, i <= Length[xlData], i++,
    (iniRow = {};
     For[j = 1, j <= Length[xlData[[i]]], j++,
      If[xlData[[i, j]] != "",     
      (iniRow =Append[iniRow,InputField[xlData[[i, j]], FieldSize -> {4, 1}]];
        result = Append[result, iniRow];)]
share|improve this question
I'm not near mma to try it out, but please see if it is similar to this question: – R. M. Sep 10 '12 at 13:50
@b.gatessucks: Yes, I have edited. – Jennifer Sep 10 '12 at 16:06
up vote 6 down vote accepted

Your code can be made much simpler as such...

xlData = {{1, "a", "b", "c"}, {2, "d", "e", "f"}};
   With[{i = i, j = j}, 
   InputField[Dynamic[xlData[[i, j]]], FieldSize -> {4, 1}]], {i, 1, Length[xlData]},

As you change values, it can be monitored by:


As written, the code keeps xlData with a List head at all times.

share|improve this answer

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.