Skip to main content
Dirlo
Inspiring
September 14, 2019
Question

Difference between the value "0" and an "empty space" in a TEB

  • September 14, 2019
  • 4 replies
  • 685 views

...

Hello Captivaters !...

I'm working on the multiplication... I want my learners to fullfil a TEB to indicate the right answer. Then they have to validate their answer by clicking on a validate button.

For example : 2 x 5 = "TEB"

Everything is fine, except when I ask them to complete such ones :

5 x 0 = "TEB"

If they let the TEB empty, and validate their answer, Captivate seems to consider that the empty TEB is equal to "0" and so considers it's the right answer (which is not, as they didn't answer anything !!...).

So I'm wondering how to make a difference between the value "0" and an "empty space" in a TEB ?

(I already tried the option of using a v_null variable but as the validate button triggers many actions, it's not so simple... and I'm looking for a simple one !...)

Thanks in advance !...

😉

...

    This topic has been closed for replies.

    4 replies

    Lilybiri
    Legend
    September 17, 2019

    You already got a link to one of my popular blogs. The problem is that Captivate doesn't allow to define the nature of the variable (string, number) but the empty variable works for both. To Captivate a text, an empty string "" and 0 are the same if you use an Expression with operators. 

    Dirlo
    DirloAuthor
    Inspiring
    September 15, 2019

    ...

    Big thanks for your answers !...

     

    After a night of thinking (strange that I dream of Captivate ???...), I finally find an option to resolve this issue :

    => I put a "?" as a default text in my TEB, and instead of asking my learners to fullfil the blank TEB, I ask them to replace the "?" with their answer...

    (But I had to "allow all" in the options of the TEB and not only "numbers"...)

     

    I tried also this :

    I create a "v_null" variable which is empty... And in my advanced action I use two conditions :

    => TEB is equal to "0"

    => TEB is different than "v_null"

    (So I can let the TEB options as "numbers"...)

    But this still doesn't work... as Captivate considers that "0" is equal to "v_null" an returns an incorrect answer ???...

     

    Edit1 : In fact, I just read that the problem is not a Captivate one but a JavaScript one... JavaScript considers 0 as null...

    Edit2 : Lieve has written a new blog about null : http://blog.lilybiri.com/where-is-null-in-cp2017

    😉

    ...

    LuisXIV
    Participating Frequently
    September 14, 2019

    Hello Le Dirlo,

    read the article by Lieve, where is null.

    https://blog.lilybiri.com/where-is-null

    Keep in mind the following definitions:

    Underfined - a variable is declared but not initialised

    Null - a primitive value that represents null, empty, or non-existent reference

    Zero - is a number

    Luis

    kdmemory
    Inspiring
    September 14, 2019

    Hi Le_Dirlo___

    You could check with javascript the String property length of the string entered into the TEB. I haven't used TEBs in Captivate so far, hence I'm not sure, how the entered string is captured as a quiz/System variable in CP. Let's just call it TEBstring. If you execute javascript i.e. on a Submit button, then it could go like this:

     

    if (TEBstring.length > 0) {
    //check if TEBstring is correct
    } else {
    //TEBstring is in any case wrong
    }

     

    This way if nothing has been entered, the TEBstring.length should be 0 and would be filtered out.

    More...

     

    Klaus