VBTrain.Net Documentation

LmsApi2.GetJsSetValue Function

Returns JavaScript that calls the SCORM function LMSSetValue (SCORM 1.2) or SetValue (SCORM 1.3).

Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean, _
ByVal returnVarName As String, _
ByVal n1 As Int32, _
ByVal n2 As Int32 _
) As String
Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean, _
ByVal returnVarName As String, _
ByVal n1 As Int32 _
) As String
Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean, _
ByVal returnVarName As String _
) As String
Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean, _
ByVal n1 As Int32, _
ByVal n2 As Int32 _
) As String
Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean, _
ByVal n1 As Int32 _
) As String
Overloads Public Function GetJsSetValue( _ 
ByVal itemName As
SetValueEnum, _
ByVal itemValue As String, _
ByVal checkForError As Boolean, _
ByVal includeScriptTags As Boolean _
) As String

Parameters

itemName
A SetValueEnum. This is the name of the item you want to set. Choices represent SCORM defined items. If an itemName contains an "n" (e.g., cmi.objectives.n.score.raw or cmi.interactions.n.objectives.n.id), then you should specify the value of the first "n" in  n1 and of any second "n" in n2.
itemValue
The value you want to set the item to.
checkForError
Boolean indicating whether or not to include error checking code in the JavaScript.
includeScriptTags
Boolean indicating whether or not to include the JavaScript opening and closing script tags. (i.e. <script language = 'javascript'> and </script>)
returnVarName
Name of the JavaScript variable that will hold the LMSSetValue return value. The returnVarName parameter also serves as the prefix for any error checking variables, and as the prefix for the hidden field in which the return value is stored (<returnVarName>_hField). See Remarks below.
n1
Integer. If itemName contains an "n" (e.g., cmi.objectives.n.score.raw or cmi.interactions.n.objectives.n.id) then n1 should specify the value of the first "n".
n2
Integer. If itemName contains two "n"s (e.g., cmi.interactions.n.objectives.n.id) then n2 should specify the value of the second "n".

Remarks

The JavaScript from the GetJsApiLocate function must be added to your page prior to using the JavaScript from GetJsSetValue.

You can use the server side RegisterClientScriptBlock method to add the JavaScript from any LmsApi GetJs function to your HTML page.

The JavaScript returned from GetJsSetValue will do all of the following:

Example

The following example assumes that the VBTrain.WebTracking.LmsApi2 namespace has been imported, and that the LmsApi for the session is stored as a property (LmsApiObject) of the current class.

[Visual Basic]
Private Sub BtnExit_Click( _
   ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles BtnExit.Click

   Dim pgName As String = Me.CurrentPageName
   Dim apiObject As LmsApi2 = Me.LmsApiObject
   Dim js As String

   js = apiObject.GetJsApiLocate()
   Me.RegisterClientScriptBlock("apiLocate", js)

   js = apiObject.GetJsSetValue(SetValueEnum.location, pgName, False, True)
   Me.RegisterClientScriptBlock("setLessonLocation", js)

   js = apiObject.GetJsForLogoff(LogoffEnum.CommitAndTerminate, _
      LogoffOptionsEnum.callsPlusWindowClose, "parent")
   Me.RegisterClientScriptBlock("apiLogoff", js)
End Sub

See Also

LmsApi2 Class | LmsApi Members | GetJsGetValue | GetJsApiLocate | GetJsInitialize