Help
Assessment API
Assessment items add these additional properties and methods to the ContentFrame API.
Properties
NameTypeMeaning
allowSavebooleanGets whether the user can save the assessment and continue at another time.
descriptionUrlurlGets the URL to the assessment item description.
maxPageintGets the total number of pages in the assessment.
pageintGets the current visible page number.
forwardOnlybooleanCorresponds to the ForwardNavigation flag on the item. The display should not allow for backwards navigation.
paperTestingEnabledbooleanIndicates if paper testing is enabled for this item.
startTimestringGets the start time, formatted in the current user's culture.
statestringGets the current assessment state. Possible values are:
  • active - the student is actively taking the assessment
  • error - the assessment encountered an error
  • password - the student or proctor must enter a password
  • review - the student is reviewing the answers after submitting the assessment
  • summary - start state of the assessment
timeLeftstringGets the time remaining for the assessment, formatted in the current user's culture.
timeLimitbooleanGets whether the assessment has a time limit.
I18NobjectGets and object containing strings in the language of the current user. These are the object properties with their accompanying English text:
  • Both - Both
  • OfN - of {0}
  • Print - Print
  • Remaining - Remaining
  • RequireAnswers - You must answer all questions before submitting
  • Start - Start
  • StartQuestion - Do you want to start now?
  • Student - Student
  • SubmitEmptyAnswersText - You have not answered one or more questions. Are you sure you want to submit your answers for grading?
  • SubmitQuestion - Navigating away will submit your answers now. Press OK to continue, or Cancel to stay on the current page.
  • SubmitStatement - Navigating away will submit your answers now.
  • SubmitText - Your answers will now be uploaded for grading. Are you sure you want to submit?
  • Submitting - Submitting ...
  • Teacher - Teacher
Events
To listen to events, call addListener on the Frame API.
EventDescription
examstatechangedFires when the assessment state changes.
examtimechangedFires when the time left changes for timed assessments.
Methods
appendToDescription
Appends the specified HTML to the description on the assessment summary page.
Syntax
appendToDescription(string html) : void
Parameters
  • htmlHTML to append to the description.
Example
This example appends some time-limit text to the summary page description.
api.appendToDescription("The time limit for this item is 30 minutes");
hasUnansweredQuestion
Checks whether the assessment has any unanswered questions.
Syntax
hasUnansweredQuestion() : boolean
Returns
Returns true if any question has not been answered.
Example
This example checks for unanswered questions before submitting.
if (api.hasUnansweredQuestion()) {
    alert('You have not answered all questions yet!');
}
else {
    api.submit();
}
performAction
Performs an action for the content displayed within the content frame.
Syntax
performAction(string type, various param) : void
Parameters
  • type Defines the type of action to perform. These are the possible values:
  • NameMeaning
    adaptivenextGo to the next question in the adaptive assessment.
    adaptivepreviousGo to the previous question in the adaptive assessment.
    adaptivesaveSave an adaptive assessment.
    adaptivesubmitSubmit an adaptive assessment.
    descriptionView the description for the assessment in a new window.
    doneGo back to the summary page.
    pageGo to a specified page number in the assessment. Specify the 1-based page number integer in param.
    printOpen the assessment for printing in a new window. Specify what to print with one of the following values for param:
    • 1 - Print an exam form for a student to take.
    • 2 - Print exam answer key for a teacher.
    • 3 - Print both student and teacher exam forms. If questions or answers are randomized, this prints an appropriate teacher key for the printed student exam.
    saveSave the assessment.
    submitSubmit the assessment.
    startStart the assessment.
  • paramAdditional, action-specific data, if any. See individual action types for descriptions of param data that the action requires.
Example
This example starts the assessment by performing the 'start' action.
api.performAction('start');
See Also
Content Frames ContentFrame API