How does validation of text entry work?

A couple of questions about validating text entry fields.

I have a text entry box, which I have pre-populated with a text string that includes a spelling mistake. I want learners to click into the text entry box and correct the mistake in the string. There might be more than one mistake. I then want Storyline to validate whether they have made an appropriate correction.

1) What exactly is Storyling validating? For example:

Sentence presented to learner: "The cat satt on the mat."

Correct answer in variable: "The cat sat on the mat."

If the learner enters: "The cat sat, on the mat."

I'm presuming that constitutes an incorrect answer, right? Whatever is in the box has to match character for character against what is in the variable?

2) Is there any way to switch off the spellcheck in the text entry field? At the moment, as soon as you click in the box, the incorrect word gets a wiggly red line underneath it, which kind of defeats the point in a spelling test...

3) Is there a way to grade responses at word level whilst presenting text in a string? I'm guessing no...

24 Replies
Ashley Terwilliger

Hi Christina,

Happy to help here!

1) Are you using a Fill in the Blank question type or something custom set up using text entry fields? If you're using a Fill in the Blank, we'll validate it against the possible correct answers you added. If you're using a standalone text entry, you'll need to set a trigger to validate what the user entered against another independent variable you set. 

2) No way to set the spellcheck off in Storyline, as that's typically a browser controlled setting and specific to individual users. 

3) Grading is done on a question by question basis in Storyline, so there isn't a setup to allow for grading each individual word.

Let me know if you have any other questions!

Matthew Bibby

2) This should be possible. Try adding this JavaScript to your Master Slide and set it to run when the timeline starts:

if (!window.disabledSpellcheck) {
document.querySelector("input").setAttribute("spellcheck", "false");
document.querySelector("textarea").setAttribute("spellcheck", "false");
window.disabledSpellcheck = true;
}

Please test in all browsers/environments to make sure it works as intended. I haven't tested it. 

3) This should also be possible. Is this the kind of thing you mean?

Christina Clark

Thanks, Matt - I'll try the spellcheck code.

3) could work I think, yes. I have managed to do most of what I wanted using multiple triggers and conditions, but my main problem is that logic is not my strong point, so trigger order and conflicting conditions are hampering progress. I essentially don't understand why some of my triggers and conditions aren't working cos they all make sense to me, but not Storyline! I suspect I would run into the same problem using Javascript because I would still need to untangle the logic.

LONG POST ALERT. Grab a cuppa...

I am writing an English test. So, multiple sentences per slide, multiple slides, some sentences are correct, some aren't, learner edits them to correct errors. We know from experience that some learners also introduce new errors into sentences that were correct already. For example:

  1. The cat sat on the mat.
  2. She is lieing in the sun.
  3. The ball of wool she is playing with and pawing at is red.

1. Sentence 1 contains no errors. I call the text entry variable Sentence1 with a default value of the correct sentence. I also set up a true/false variable called Sentence1Correct that assesses whether the sentence is still correct when the learner moves on to the next slide. This has a default value of true because the sentence is already correct. I have a trigger on a custom NEXT button "set Sentence1Correct to false when user clicks NEXT if Sentence1 is not equal to "The cat sat on the mat."

Learners can move back and forth between slides, so I also need to be able to change the value back to true in case a learner realises their mistake and corrects it. So I have "set Sentence1Correct to true when user clicks NEXT if Sentence1 is equal to "The cat sat on the mat." I can't figure out if it matters which order these two triggers are in. At one point it looked like I had to have the false trigger above the true one, but that didn't work consistently.

All the same triggers exist on the custom PREV button, too.

2. the word "lieing" is misspelled. Sentence2 text variable has a default value of the incorrect sentence. The true/false is set to false because the sentence is incorrect to start with. Trigger on the next button says "set Sentence2Correct to true when user clicks NEXT if Sentence2 is equal to "She is lying in the sun." Another trigger says "set Sentence2Correct to false when user clicks NEXT if Sentence2 is not equal to "She is lying in the sun." Again, no idea if order matters.

3. there is no error here, but learners may want to insert commas, which I don't want to penalise them for. This sentence has a default true value. Trigger says "set Sentence3Correct to false if Sentence3 is not equal to "The ball of wool she is playing with and pawing at is red." OR "The ball of wool she is playing with, and pawing at, is red."

This last trigger isn't working - storyline will only set the value to false if there is only one condition.

AND

the scoring isn't working right. Because learners can change their answers as much as they'd like, I do the scoring on the How Many quiz slide which they only reach once they submit all their answers, so after all the true/false values are set and not going to change again. I have triggers to add 1 to score when the timeline starts if sentence1correct is true, subtract 1 from score when the timeline starts if sentence1correct is false etc. The subtract triggers aren't working or sometimes I get a "you must complete the question before submitting" error so I know my triggers are wrong somewhere, but I can't see where.

So there you go. I can't untangle it. I have about 12 versions of this test now. I always seem to manage to sort out 4 out of 5 problems, but when I fix the last one, a new one appears. 

 

Phil Mayor

I think there are two possible options, rebuild using a text entry question with a few other triggers to ensure you can go back and forwards.

The text entry question will allow you to validate more than one correct answer.

Or, you validate the answer using javascript, this would be ideal for 2 and 3 as you can then strip out the commas and validate

Matthew Bibby
Christina Clark

The spellcheck code didn't work, I'm afraid. At least in Chrome.

I just tried it here and it seems to work okay for me. 

In Chrome, before adding the JavaScript, this is what happens:

And after the code is added:

It also works fine when the text entry field already contains a string:

Here is a demo.

And here is the .story file (the JavaScript is on the Slide Master).

Christina Clark

Thanks Matt. I copied the exact code from your story file into mine and made sure it was on the slide master (I had it on a sub-layout of the master so thought maybe that was the problem).

I tested in SCORM cloud and still got wiggly lines, I'm afraid. Could publishing to SCORM be the culprit?

Christina Clark

Apologies for delay. Yes, that works. How odd. No idea what I'm doing wrong.

A colleague who is new to Javascript and has no knowledge of Storyline gave me this code snippet:

document.querySelector("#main-window").setAttribute("spellcheck", "false");

That works but you'll know better than I if it's "good" code cos to me it's just a string of characters with no meaning! :-) We suspect it would be Chrome only as it gets around how Chrome interprets the textarea attribute - they are all children of the main page, so this took care of it.

So this will do for now. I have signed up to a Javascript course on Udemy so no going back now! Thank you for all your help.