Picture of Matt Leathes
Re: Get the value of textbox in designer view and store it as global variable in .js
by Matt Leathes - Friday, 25 January 2019, 10:35 AM

Assuming the course author has actually set the value of _components._textConfirmation.Database (either via the authoring tool or manually via course.json if using the framework) then Adapt.course.get('_globals')._components._textConfirmation.Database should contain the value they entered.

I would recommend you use the developer tools to do a bit of exploration... if you execute var Adapt = require('core/js/adapt'); in the Console you will then be able to run Adapt.course.get('_globals')._components in the console to have a proper look around.

Equally you can use the debugger to add a breakpoint in your text confirmation component, allowing you to explore that in more detail.

I recommend you do all this in the framework - it's a lot easier getting new functionality like this working in there first. Once that's done, upload the plugin to the authoring tool and check it works there.