Enforcing a min/max range using a Slider is easy. Here it a Number is constrained to 0..1:

Manipulate[number, {{number, 0.3, "Number:"}, 0, 1, ControlType -> Slider}]

But when using an InputField control the min/max range seems to be ignored:

Manipulate[number, {{number, 0.3, "Number:"}, 0, 1, ControlType -> InputField}]

This enforce a Number but still does not enforce the min/max range:

Manipulate[number, {{number, 0.3, "Number:"}, 0, 1, InputField[#, Number, FieldSize -> 10] &}]

Image showing Slider vs InputField in Manipulate for a Number


1 Answer 1


InputField does not have 'min/max' support but you can do:

  { {number, 0.3, "Number:"}
  , InputField[#, Number, ContinuousAction -> True] &
  , TrackingFunction :> Function[number = Clip[#, {0, 1}]]

edit: live restriction

  • $\begingroup$ thanks for the suggestion, but this is only a partial solution. It does not restrict (live) in the input field, and AFAICT it even permits entry of non-numerical alpha characters (I didn't specify that requirement in my question, but using Number as I showed in my question does restrict the character entry) $\endgroup$ Commented Apr 28, 2022 at 11:40
  • $\begingroup$ @WebelITAustralia-upvoter take a look now, does it fit your needs? $\endgroup$
    – Kuba
    Commented Apr 28, 2022 at 21:37

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.