Skip to main content
Participant
February 21, 2013
Question

Reset variable to blank

  • February 21, 2013
  • 13 replies
  • 2518 views

I have a Captivate slide with four text entry boxes, each with an associated variable.  When the slide first loads, the TEBs are blank.  The user must populate them in order to advance to the next slide.  However, if the user returns to this slide, I want the TEBs to be blank again.  I do not want the user's previously typed value to display.

I have an advanced action that I call in slide's onEnter event.  I have tried:

assign variable variable name with ""

assign variable variable name with " "

assign variable variable name with space

I also tried the above using the TEB's label name in place of the variable name and I created an extra variable with no value and tried to assign that to the teb variables to no avail.  Each time I return to the slide, the previous value displays.

How can I reset the variable / TEB to a blank value?

I'm using version 5.0.3.631

    This topic is closed to new replies. Start a new post to keep the conversation going.

    13 replies

    Participating Frequently
    August 15, 2018

    I think I may have found a way to address this while creating a survey quiz that captured all the user's answers to their questions on a summary page. To do this I captured the answers into variables that would be displayed in text boxes. I also wanted a way to allow the user to retake the survey quiz if they realized they didn't like their answers so I needed a way to clear the answers assigned to the variables displayed in the text boxes. What I basically did is create a variable called 'blank and left its value empty. Then, on my custom retake button, I assigned the blank variable to all of the variables displayed in the text boxes.

    So basically, it might be as simple as setting your variables to another variable that is always blank?

    Lilybiri
    Legend
    August 16, 2018

    I blogged twice about this solution with a blank variable, first one was 8 years ago:

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

    That article has many views. I created a refurbished post, which is not viewed at all recently:

    http://blog.lilybiri.com/where-is-null-in-cp2017

    Lilybiri
    Legend
    February 22, 2013

    Vish, the variable is not set to blank in that case, only it will not be displayed when returning but still has that value. So if this variable is used in an (advanced) action, this could lead to problems.

    If you really want to have control over the variable associated with the TEB and with what is displayed, you need to grab Jim Leichliter's widget that allows you that control because it will display the value of the variable all the time, and if you set the variable to a null-variable (empty variable) the TEB will reflect it. Moreover, it is a free widget (Jim has similar ones for checkboxes, radiobuttons and TextArea widget, blogged about all those).

    http://captivatedev.com/2010/09/08/adobe-captivate-widget-using-variables-in-the-default-text-of-a-text-entry-box-teb/

    Lilybiri

    BTW: your Assign actions will not work, have a look at my article:

    http://lilybiri.posterous.com/where-is-null

    Participating Frequently
    November 23, 2015

    Do you know if this functionality has changed in Captivate 9?

    I tried entering the variable name with $$ on both sides for the TEB default text. I also unchecked the Retain Text box.

    Instead of displaying the variable's value in the published version it displays the exact text with the $$ that I had entered. Is there a better way to handle this?

    (I ask because I'm looking for a way to retain the text entered by the user until the user intentionally clicks a button to reset all the variables.)

    Thank you!

    Wendy

    Lilybiri
    Legend
    November 23, 2015

    I never told you can do that! Nothing has changed in the TEB behavior, there is no way to control what is displayed.


    For SWF output you can control what is displayed in a Scrolling Text interaction using an advanced action to change the variable. It has never been possible to insert a variable in that interaction neither. For HTML output the control is not functional for some reason.

    Participating Frequently
    February 22, 2013

    Hello There,

    Disable 'Retain Text' option in TEB Properties, that should make the text box empty when you return. Please let me know if it helps.

    Thanks,

    Vish