Lectora Tips #1: Student Name Formatting

Unless you’re training 007’s, your students probably read their first name then last name. However, Lectora’s default settings place the last name first, e.g. Bond, James, which is less than desirable. Never fear, Jim Heiliger is here!
Just follow these 3 STEPS to modify the name display using JavaScript–it’s easier than you think.

  • STEP 1 – Insert a new action on the page with the text field you would like to populate;
  • STEP 2 – Add custom script and enter the following information;

<script type=”text/javascript”>

function getNameFun() {

var nameArray = new Array();

var me = AICC_Student_Name.getValue();

nameArray = me.split(“,”);

var fullName = nameArray[1] + ” ” + nameArray[0];

text114758.actionChangeContents(fullName,’alignright’,’1′);

}

var t=setTimeout(getNameFun,2000);

</script>

  • STEP 3 – You will need to change text114758 with the name of the text field you are modifying. You can do this by double clicking the text field and the name will appear in the top right.

Publish your Lectora eLearning course and your students’ names should go from Bond, to James bond!

Leave a Reply