Picture of si yifan
Adapt.offlineStorage
by si yifan - Tuesday, 7 April 2020, 2:57 AM
 
I need to save all the information entered by the user on the interface to the database. Does anyone know the specific usage of the following? It would be better if there were specific tutorials. Adapt.offlineStorage.set(name, value); Adapt.offlineStorage.get(name);
Picture of Matt Leathes
Re: Adapt.offlineStorage
by Matt Leathes - Tuesday, 7 April 2020, 9:31 AM
 
I need to save all the information entered by the user on the interface to the database

What interface? What database? Are you talking about the authoring tool? If so, what version?

The offlineStorage API is there to allow a course to save data to the LMS (or LRS).

Picture of si yifan
Re: Adapt.offlineStorage
by si yifan - Sunday, 10 May 2020, 1:08 PM
 
My question is how to get the information entered by the user on the user interface by authoring tool with the newest version. In more detail, when I enter 'aaa' in the first question, the serial number of the question returned is 'undefined'. And through 'API.LMSGetValue' can not get 'aaa', but 'undefined'.
 
 
 
 
 
 
 
Picture of Matt Leathes
Re: Adapt.offlineStorage
by Matt Leathes - Monday, 11 May 2020, 10:53 AM
 

So, the purpose of the authoring tool is to allow a content author to create courses without having to know how to edit JSON or apply HTML formatting. You can also preview the course from the authoring tool so that you can check that it looks right before publishing and uploading it to wherever you normally host your elearning courses - typically a SCORM Learning Management System (LMS).

The authoring tool should not be used to allow learners to access and run the courses. You should always publish them and host them elsewhere.

The reason you are seeing the 'undefined' value is because the adapt authoring tool is NOT a SCORM Learning Management System. If you upload this course to an actual LMS that has support for cmi.interactions you will see a number instead of undefined, like this:

However, the course only ever has 'write' access to these data fields, it will not be allowed to read data from them. Only the LMS itself can do that.

you can find out more about SCORM here https://scorm.com/scorm-explained/technical-scorm/

Picture of si yifan
Re: Adapt.offlineStorage
by si yifan - Tuesday, 12 May 2020, 2:06 PM
 
Thank you very much for your detailed solution! As a content author, I need to get the information that the respondent entered here and save it as an object. Could I get the data ‘aaa’ by using ‘Adapt. OfflineStorage. Get (' the cmi. Interactions. 0. Student_response ')’ ? Maybe I don't have a good understanding of this aspect. If not, what should I do? Thanks again!
Picture of Matt Leathes
Re: Adapt.offlineStorage
by Matt Leathes - Tuesday, 12 May 2020, 3:27 PM
 

If the course is running on an LMS that has support for cmi.interactions then you might be able to get that data from the LMS.

You can't fetch data from cmi.interactions from the course because these SCORM data fields are 'write only' so the course can only write data to them, it can't read that data back in again.

If you can't do this on the LMS then I can't think of a way of doing it without some form of customisation, such as writing an extension that listens out for the learner answering this particular question then querying the component for the data.

Here's a very simple example of how you'd query the component for the data via the browser console, after answering the textInput component in the Adapt v5 demo.

Picture of si yifan
Re: Adapt.offlineStorage
by si yifan - Wednesday, 13 May 2020, 7:24 AM
 
Thank you very much for your answers, and this method is feasible after I tried. But there is still a question, how can I get or change the ID of the imported component? Because I found that every time the authoring tool  started, it will generate a random ID, not a fixed ‘c-70’ like the example you gave.
 
 
 
 
 
 
 
Picture of Matt Leathes
Re: Adapt.offlineStorage
by Matt Leathes - Wednesday, 13 May 2020, 7:21 PM
 
Because I found that every time the authoring tool  started, it will generate a random ID

Are you sure it's doing that? I really hope it's not as, if it is, that is potentially a very serious bug. What version of the authoring tool are you using?

Picture of si yifan
Re: Adapt.offlineStorage
by si yifan - Thursday, 14 May 2020, 1:55 AM
 

The version of authoring tool I'm using now is 0.10.3, and adapt framework v5.3.0. And I'm not sure if there is some problem with my operation.

When I click the button 'Copy ID to clipboard' on the page of editing course, it will directly prompt me the ID of the current plugin. And I have not modified the id information anywhere. And every time I start adapt framework through the node server, it will generate a different id after repeating the above operations.
 
 
 
 
Picture of Matt Leathes
Re: Adapt.offlineStorage
by Matt Leathes - Thursday, 14 May 2020, 10:28 AM
 
And every time I start adapt framework through the node server, it will generate a different id after repeating the above operations

It really shouldn't be doing that. Definitely not doing that on the many instances of the AAT we host here at Kineo. We would definitely notice something like that as it would break almost all courses every time we restarted the AAT servers.

Picture of si yifan
Re: Adapt.offlineStorage
by si yifan - Wednesday, 3 June 2020, 2:26 AM
 
I want to know if there are other similar methods to get the information entered by the user, for example, by the name of the control like "findbyname" ?