evalCommand inserting a text

geouser shared this question 10 years ago
Answered

Hello everybody,


I would like to add a jscript form with a textbox where my students write their name and an Accept button that introduces the name in the window of Geogebra.

I've created in the Geogebra file a text object called "a".


The code I've inserted is:


    <form>

    <p align=center>

    Write your name:

    <input type="text" name="T1" size="20" value="" >

    <input type="button" value="Accept" name="B1"

    onclick="document.ggbApplet.evalCommand('a='+T1.value);">


    </p>

    </form>


The problem is that the student must write the name between quotes, so that Geogebra understands it as a text.


I've tried to add quotes to the evalCommand, but it doesn't work:


    onclick="document.ggbApplet.evalCommand('a=" '+T1.value+ ' " ');">


Could someone help me?

Thanks in advance!

Comments (1)

photo
1

Hi

try:

onclick="document.ggbApplet.evalCommand('a=Text[""+'T1.value+']' );"

othewise trythis one in ggb4


https://ggbm.at/548001

© 2021 International GeoGebra Institute