Send text from shape to a variable

Jul 18, 2012

Hi,

Is there a way I can capture the text inside a shape in a freeform interaction, to show up in a variable, so I can then work some magic using Javascript ?

5 Replies
Alexandros Anoyatis

The text is "embedded" in the shape. It's not grouped (I need the states), and it's not a textbox (I absolutely need the shape).

The 4 shape(s) actually form the answers in the freeform. The answers themselves are randomized.

The interaction itself is quite complex (there's eye-candy, then submission is made halfway through the interaction and then there's more eye-candy) but works and validates perfectly using 3 variables (one used for delayed display of the result, and two for flagging correct-incorrect answer).

However, there are 3 extra cases that i need to take care, for which i will have to use javascript. And for that I need to somehow extract whatever is written inside these 4 shapes.

I also need to find how I can pass the correct answer (or correct original letter of the answer - A, B, C, D) to a variable for other calculations.

For example :
A : I need to give a tip (based on probability) for which I will have to identify the right choice (e.g. student asks for a gimme tip and the interaction replies "If i were you i would probably choose %shape1% " if %shape1% is actually the correct answer).
B : Remove/hide an incorrect choice from the list of choices (before the question is actually answered).

Or maybe I need to get some sleep and talk to you ladies and gents tomorrow...

Alexandros Anoyatis

I've done that on two variables (correct/incorrect) that are used for state change after the answer is evaluated (change background of shape to green if answer is correct / change background of shape to red if answer is incorrect).

I suppose I could get half way there by using text inputs outside the story area like Jill suggested.

However, to take it one step further, I need to know which answer is the correct one, before a choice is even made.

I'd better get crackin'...

This discussion is closed. You can start a new discussion or contact Articulate Support.