HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... if conditions
if conditions
  View type:
Hello!

I gave the actions if and else to a button. The error I get is "? action: ELSE".
My sencond approach was to test it in Javascript. There I canґt make out how to get the value from a textinput. How can I make it work?
 
Finally, after long hours of desperately searching for how to make either if action or if-else action work, I have the solution! It might interest some of you.

In the action window you have to right click on the object ((pe else or any other object that depends on if), which you find in the middle column), and push right mouse button in order to open the context menue where you select "move->right".

IF (Condition='#x==#y')
MSGBOX (Text=...)
ELSE
MSGBOX (Text=...)
GOTO

I looked through the help and documentation where I could find no hint on this.[:(]



 
 
Unfortunately my code snip example is useless because after sending the message the whithespaces were dropped. Imagine that MSGBOX and ELSE are positioned under the C of Condition. [:o]
 
 
 
If I understand you right, now you have the problem by the else statement. Try this.

> by the code means one time "move-right".
>> means two times "move-right"

IF (Condition='#x==#y')
>MSGBOX (Text=...)
>ELSE
>>MSGBOX (Text=...)
GOTO
 
 
 
 
How can this be done if there are 3 conditions? I want the button to take the user to a page either low/medium/high score page.

I have:
If score <= 120 then go to slide x
if score >= 250 then go to slide y
else go to slide z

but it doesn't work for all three ranks of scores. Is it something to do with the indents (if it is where do these spaces need to be placed?) or are my conditions incorrect?

Thanks!
 
 
 
 
 
You might use '&&' (AND) in your condition. See helpfile: Actions - IF - bottom of page.
if ((#var1 >= 120) && (#var2 < 250))
 
 
 
 
 
Its in the logic of the statement I think.
If you have this
If score <= 120 then go to slide x
if score >= 250 then go to slide y
else go to slide z
The first if is evaluated and is found to be either true or false, if true then it performs the goto. Now at this point its been evaluated and there isn't an else to say do something else after the lines been evaluated. The whole thing then stops.
If you use
If score <= 120 then go to slide x
Else
if score >= 250 then go to slide y
else go to slide z
Now the first if is evaluated and is found to be either true or false, if true (0-119)it loops out if false the else forces the next IF THEN to be evaluated with the final else catching a score between 120 and 250.
Subject:
Message options
No additional options