I have a Panel with 4 Inputfields and a Button. When a Button is clicked, it shifts itself and adds two Inputfields in its place. Before clicking Button,

enter image description here

and after clicking Button.

enter image description here

I want to know how can I shift Button ?


2 Answers 2


You could use Dynamic as in :

iField = Table[InputField[], {i, 2}, {j, 2}];

Panel[Dynamic@Grid[Join[iField, {{Button["Add", 
   AppendTo[iField, {InputField[], InputField[]}]], ""}}]]]

A recursive solution would allow for the fields to stay intact when adding

DynamicModule[{var = False},
    Column[{Grid[{{InputField[], InputField[]}}],
      Dynamic[If[var, #0[], Button["Add", var = True]]
    ] &[] // Panel

However, you won't be able to go above approximately 50 I think


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.