How to restrict the range of a number linked to an input box?

KongChan shared this question 3 years ago
Needs Answer

I would like to inquire about how to restrict the range of an input box’s number?

I have searched the internet and found out that I should set the minimum and maximum of a number linked to the input box, as indicated in the following article:

https://help.geogebra.org/topic/input-box-range

In the past, this method worked well. But this method failed recently. I entered a number larger than the predefined maximum into the input box, and this number was accepted. I also found out that the maximum value of the variable was adjusted automatically (became larger) by the program so the input number now became legitimate.

I tried this on a desktop Windows version of the GeoGebra (Classic 6) and on an applet on my GeoGebra website. The link of the applet is attached for your easy reference: https://www.geogebra.org/m/xZQQN3kx

Many thanks for any assistance!

Comments (3)

photo
2

As a workaround, if a is the linked object, and you want its max value equal to a value n, you can use e.g.


If(a>n, SetValue(a,n))


in the OnUpdate script of the linked object.

I'm looping this post to the developers, thank you.

(Same behaviour also on ggb v.5 Classic)

photo
2

To restrict the range,

create a variable for the max value of slider

74078313a8a88697c76a7f029daaf46b

photo
1

Many thanks for your valuable advices!!

© 2023 International GeoGebra Institute