Add Users Name to SCORM Course

robm
robm Community Member Posts: 50 ☆ Roadie ☆
1. Add the following variables in the variable manager:   a. firstName   b. middleName   c. lastName   d. fullName2. Add a text box on the page to be a place holder for the user’s name.3. Add Action Group named “Process & Insert name” to Page. 4. Add “Dummy” Actions to the Action Group named “Process & Insert name”   a. General Tab        Name: Pass AICC_Student_Name        Action: Show        Target: Content Column 1      Condition Tab         Variable: AICC_Student_Name        Relationship: Is Not Empty   b. General Tab        Name: Pass firstName to JS        Action: Show        Target : Content Column 1      Condition Tab         Variable: firstName           Relationship: Is Not Empty   c. General Tab        Name: Pass middleName to JS        Action: Show        Target : Content Column 1      ConditionTab         Variable: middleName           Relationship: Is Not Empty   d. General Tab        Name: Pass lastName to JS        Action: Show        Target : Content Column 1      Condition Tab         Variable: lastName           Relationship: Is Not Empty   e. General Tab        Name: Pass fullName to JS        Action: Show        Target : Content Column 1      Condition Tab         Variable: fullName           Relationship: Is Not Empty5. Add another Action to the Action Group named “Process & Insert name”   a. Name: Run processName JS function      Action: Go To      Target : Web Address      Web Address: javascript:processName();6. Add one more Action to the Action Group named “Process & Insert name”   a. Name: Insert Name into Name Text      Action: Change Content      Target: Name (text box)      Contents: firstName, lastName or fullName 7. Add Action to the top level of the page   a. Name: Run Process & Insert Name      On: Show      Action: Run Action Group      Target: Process & Insert name8. Add External HTML Object below Action Group   a. Object Name: processName JS Object      Object Type: Header Script      Custom HTML:function processName() {// Load Lectora variable AICC_Student_Name into Javascript variable StudentNameJSvar StudentNameJS = AICC_Student_Name.getValue();var commaPositionJS = StudentNameJS.indexOf(",");var firstSpaceJS = commaPositionJS +1;var lastSpaceJS = StudentNameJS.lastIndexOf(" ");     if (firstSpaceJS != lastSpaceJS) {      VarfirstName.set(StudentNameJS .substring(firstSpaceJS, lastSpaceJS));      VarmiddleName.set(StudentNameJ S.substring(lastSpaceJS));      VarlastName.set(StudentNameJS. substring(0, commaPositionJS));      VarfullName.set(VarfirstName.g etValue() + ' ' + VarmiddleName.getValue() + ' ' + VarlastName.getValue());     } else {      VarfirstName.set(StudentNameJS .substring(firstSpaceJS));      VarlastName.set(StudentNameJS. substring(0, commaPositionJS));      VarfullName.set(VarfirstName.g etValue() + ' ' + VarlastName.getValue());     }}