In Mathematica 9, there's an interaction between InputField and Row. The following fragment (without or without Module and options):

     opts = { FieldSize -> 10, FieldHintStyle -> {Black}, 
       Appearance -> Framed};
      {InputField["", String, FieldHint -> "Field 1", opts],
       InputField["", String, FieldHint -> "Field 2", opts],
       InputField["", String, FieldHint -> "Field 3", opts]}]

Will correctly output the row of input fields and correctly handle text entered in the first field chosen by the user (not necessarily "Field 1"), but tabbing to and entering text in next field is converted to input form.

Whereas, removing Row, as in:

{InputField["", String, FieldHint -> "Field 1"],
 InputField["", String, FieldHint -> "Field 2"],
 InputField["", String, FieldHint -> "Field 3"]}

Results in correct operation (including tabbing across fields). Passing the above list to Panel, Column or Grid (make two sets lists) also works fine.

Known issue?

  • $\begingroup$ Still the same (bug?) problem in v 11.0.1 $\endgroup$ – SquareOne Feb 6 '17 at 14:55

I believe you need Deploy to keep the Row elements from being selectable.
Here in version 7 compatible format:

 opts = {FieldSize -> 10, Appearance -> Framed};
   InputField["", String, opts],
   InputField["", String, opts], 
   InputField["", String, opts]
 }] // Deploy
  • $\begingroup$ That works, but how ugly that it's necessary for Row and not Column or Grid? What's the reason? $\endgroup$ – alancalvitti Aug 23 '13 at 20:37
  • $\begingroup$ @alan Well, Tab doesn't seem to move between the fields of a Column or Grid so you don't see this specific problem, but strictly speaking I think Deploy should be used with all three, as otherwise you can select and overwrite the fields. $\endgroup$ – Mr.Wizard Aug 23 '13 at 20:43
  • $\begingroup$ I can tab between fields even if arranged with Column and Grid. $\endgroup$ – alancalvitti Aug 23 '13 at 20:45
  • $\begingroup$ @alancalvitti I was suspecting that Grid will work while Column will show the same behavior as Row but now it's strange... $\endgroup$ – Kuba Aug 23 '13 at 21:17
  • 1
    $\begingroup$ The Row option Selectable -> False also seems to work. $\endgroup$ – Michael E2 Aug 24 '13 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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