Skip to main content
Known Participant
September 27, 2021
Answered

Random Question about possibility to create a simulation

  • September 27, 2021
  • 2 replies
  • 573 views

Is it possible to create a quiz thru the use of AA in which the end user can type a string of letters, numbers, special characters (aka a password) and as long as certain conditions are met, be given feedback of it is correct or not?

 

If this is too far out there, I get it. I'm having one of those well is this possible moments.

    This topic has been closed for replies.
    Correct answer RodWard

    Captivate cannot do (with default functionality) what you are hoping to achieve in this case because you want the student to be able to type in any combination of letters that obeys the required password rules and be marked correct. 

     

    Captivate's validation options on normal quiz questions with fields (e.g. the Short Answer Question) are limited to matching the learner's answer to specific correct answers that you have to supply beforehand.

     

    To achieve what you're looking for you would need to be using Text Entry Boxes and JavaSCript code, and possibly even Regular Expressions, to parse the learner's answer in the TEB to check for a match.

     

    So the short answer is that what you want to do is possible, but not unless you have access to someone that can help with the technical programming aspects.

    2 replies

    Stagprime2687219
    Legend
    September 27, 2021

    I found this to be an interesting question - so I decided to explore it a bit.

    Here is what I managed to come up with.

     

    As Rod stated - we will need a text entry box for the participant to enter some characters.

    This TEB is set to a variable - in my case - called  myPass

     

    I have some JavaScript placed onEnter to the slide to help prep things for the validation.

    // declares a variable called checkPass to later use as an array
    var checkPass
    
    // This array stores the various values we will accept as a special character
    var specials = ["<",">","@","!","#","$","%","^","&","*","(",")","_","+","[","]","{","}","?"];
    
    // This function checks to see if the password meets our criteria and resets the flags
    function verify() {
    if (num + spec + upper + lower == 4) {
    console.log("Valid Password");
    }
    else {
    console.log("Invalid Password");
    }
    num=0;
    spec=0;
    upper=0;
    lower=0;
    }
    
    // This function checks each type in order of number, special, upper, and lower case
    function checkCase(item) {
       if (!isNaN(item * 1)) {
          console.log(item + " is numeric");
          num = 1;
          }
        else if (specials.includes(item)==true) {
             console.log(item + " is special");
             spec = 1;
          }
        else if (item == item.toUpperCase()) {
             console.log(item + " is upperCase");
             upper = 1;
          }
        else if (item == item.toLowerCase()) {
             console.log(item + " is lowerCase");
             lower = 1;
          }  
    }

     

    Then we have some JavaScript on the button to check to run things.

    // This splits what the leaerner entered into individual characters for examination
    // Values are placed into the checkPass array
    checkPass = myPass.split("");
    
    // For every item in the checkPass array - run the checkCase function
    checkPass.forEach(checkCase);
    
    // in a half second - check if the password meets criteria
    // This allows time for the function checks on the password to complete.
    setTimeout(verify, 500);

     

    I chose to log to the console to verify all was working as you can see below but you could have whatever else happen instead.

     

    If I change one to be capital (the W) - it returns valid.

     

     

    Known Participant
    September 27, 2021

    I wish I knew JS like this, LOL.

    Lilybiri
    Legend
    September 27, 2021
    Known Participant
    September 27, 2021

    I think what I'm looking for relates to a topic you had with another captivate user How to verify that the variable "does not contain" a value? from 2014 you mentioned that there's no negative equivalant. What I'm trying to acheive is an answer from the user that encompasses any combination of letters (upper and lower), numbers, and special characters with a max length of 14 characters to teach them how to create a strong password. If they fail to meet these parameters, they they essentially fail the quiz question. So I may be reaching here. Don't know if that can be done with AA. Simlar to Paul's Evaluate Answers in Adobe Captivate Text Entry Boxes but not whole words but induvidual characters that can be combined in any manner as long as it meets certain perameters.

    Known Participant
    September 27, 2021

    i.e. if Johnny Bravo put %5tya_p56wk$2r as his password this would be marked wrong because he didn't include uppercase letters.