On slide 1 I have a Text Entry Box, (called TheTeb) with a Submit button. TheTeb has variable associated with it called TypedText.
In the box, the user may type anything.
On slide 2 there is a caption.
The caption must show the text that the user typed into TheTeb but filtered so that only the letters, numbers, and spaces can be shown.
For example,
if the user types: 123 & abc /DEF
the caption will show: 123 abc DEF
This requirement is represents the behavior of an application that I am simulating, so I don't want to change the interaction in any way.
My strategy is to use 2 different variables, one for the text entry box (TypedText), the other for the caption (FilteredText). I can add JavaScript to the On Enter event of slide 2. The script will Get the TypedText, pass the TypedText to FilteredText, and run a regular expression somewhere so the filtered text displays on slide 2.
Here's the script so far:
var objCP = document.Captivate;
var ScriptTypedText = objCP.cpEIGetValue('TypedText');
function ReturnValue(){
objCP.cpEISetValue('FilteredText', ScriptTypedText);
}
ReturnValue();
The script works as is. The user types text on slide 1 (as TypedText), presses Enter and the text shows up on slide 2 (as $$FilteredText$$). Obviously, the trouble is, I don't know where to add my regular expression into the JavaScript so the text actually gets filtered. Do I make a new function?
By the way, a sort of pseudocode syntax for the expression would be:
FilteredText = TypedText.replace(/ /g,"");