ggbApplet.getValueString("textObject") returns object value if text value is "object"

William Oakley shared this question 3 weeks ago
Needs Answer

I'm running into a minor issue with input boxes in geogebra. I've linked an example below.

I'm running a bit of javascript in the text objects associated with my input boxes to check for odd inputs and correct them back to a "?" in the event someone tries to enter odd strings which in some cases can create / change other objects on the canvas (what i'm trying to avoid).

When the name of an object is entered into one of these input boxes in quotations (as a string - "objectName") the script will actually pull the value of the named object and assign that value to the text object via the script. it will also parse some geogebra script if it's entered in the same way (try entering "x(A)" in the attached example).

I'm trying to find a way to prevent anything but a range of numerical entry or specific strings that correspond to correct answers. If anyone has any suggestions on how to improve this script or the method i'm using I would greatly appreciate the input.

https://www.geogebra.org/m/ugvsuh5x

Comments (1)

photo
2

If you want to allow specific strings and numbers then you probably need to use https://wiki.geogebra.org/e...

© 2019 International GeoGebra Institute