Getting student name to print first name, last name

domanjem
domanjem Community Member Posts: 19 ☆ Roadie ☆
I am trying to have a certificate print with the students name. When I do it prints last name, first name. I want it the opposite. Is there a way to do this besides having the user enter the info and capturing it using variables?I am trying to have a certificate print with the students name. When I do it prints last name, first name. I want it the opposite. Is there a way to do this besides having the user enter the info and capturing it using variables?

Comments

  • aoswald
    aoswald Community Member Posts: 118 ♪ Opening Act ♪
    I have the same problem
  • carlfink
    carlfink Community Member Posts: 938 ♦ Idol ♦
    @aoswald, you are responding to a 12 year old message.

    People can help you better if you give more information. What version of Lectora are you using, for starters?
  • aoswald
    aoswald Community Member Posts: 118 ♪ Opening Act ♪
    figured it out - thanks
  • andrew-robertson
    andrew-robertson Community Member Posts: 181 ☆ Superstar ☆
    How did you do it? It'd be nice if you provided the details on how you made it happen so that if others stumble across your request they can get the assistance too. I have always done it with JavaScript, but it'd be interesting to learn how you did it.
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.
  • aoswald
    aoswald Community Member Posts: 118 ♪ Opening Act ♪
    used three actions. the first was
    AICC_Student_Name.value = AICC_Student_Name.getValue()

    the 2nd and this is not original with me. I found it here but can't remember the name of the guy who posted it.
    // override AICC_Update
    AICC_Student_Name.update = function(){};
    // reformat the student name
    var studentName = AICC_Student_Name.value;
    studentName = studentName.replace(/,/g," ");
    studentName = studentName.replace(/\s+/g," ");
    var studentNames = studentName.split(" ");
    if (studentNames.length > 3)
    AICC_Student_Name.value = studentNames[1] + " " + studentNames[2] + " " + studentNames[0] + " " + studentNames[3];
    else if (studentNames.length > 2)
    AICC_Student_Name.value = studentNames[1] + " " + studentNames[2] + " " + studentNames[0];
    else if (studentNames.length > 1)
    AICC_Student_Name.value = studentNames[1] + " " + studentNames[0];

    And the third was just to "Change Contents" in the text box where the name goes.


    It works great
  • andrew-robertson
    andrew-robertson Community Member Posts: 181 ☆ Superstar ☆
    Exactly what I do. Great job on figuring it out.

    Providing the answer to your own question is the best learning that can be done, the second best is learning from others who have already figured it out..

    Thanks for sharing.
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.