Transmettre une valeur via un input HTML à une fichier GGB

Demaria Philippe shared this question 6 months ago
Answered

Bonjour,

je souhaite faire passer une valeur de situation via un form HTML à un script GGB qui contient la variable situation.

J'ai donc dans mon formulaire HTML :


<input type="text" id="situation_id" name ="situation"/>et mon script avec la clé appletOnLoad:


var parameters = {
"appname":"classic",
"id" :"ggb_applet_container",
"showToolBarHelp":false,
"errorDialogsActive":false,
"useBrowserForJS":true,
"langage":"en",
"filename":"mon_fichier",
"appletOnLoad" : function(applet) { 
applet.setValue("situation", ???????); ???????
} // fermeture de ma fonction
}// fermeture des paramètres

var applet = new GGBApplet('5.0', parameters,true);

applet.inject('ggb_applet_container', 'preferHTML5');

Mais pas moyen !

Si quelqu'un peut m'éclairer.

MERCI.

Comments (4)

photo
1

Please post a link to the .html

photo
1

In fact, I want to send a value inside my GGB file. It's ok for the width and height with this :

        <script type="text/javascript">
             // parameters of the geogebra app
            var parameters = {
                "appname":"classic",
                "id":"ggb_applet_container",
              "prerelease":false,
              "width":{{ exercise.width }},
              "height":{{ exercise.height }},
              "useBrowserForJS":true,
                  "langage":"en",
              "filename":"../../../../static/uploads/{{ exercise.ggbfile }}",
               "appletOnLoad" :  function(applet) {  
                        applet.setValue("situation",{{ exercise.situation}});
                }
             }
            var applet = new GGBApplet('5.0', parameters,true);
            // Geogebra applet creation
            applet.inject('ggb_applet_container', 'preferHTML5'); 
        </script>

In my GGB file, there is a variable who called situation. An I want that this variable "situation" take the value {{ exercise.situation}} who come from my dataBase. I read that I need appletOnLoad key in the dico but I don't succed...

photo
2

Please post the full html

photo
1

it works !

© 2020 International GeoGebra Institute