-
1. Re: execute javascript captivate 7
RodWard Sep 16, 2013 10:24 PM (in response to Shirin_B)This JavaScript approach may be unnecessary.
You can set Failure Levels to 3 and then configure your first and second Failure captions to be transparent captions with no text. They will appear on screen when the user enters an incorrect answer but will not be visible. Only your third Failure caption will be visible. And that will only appear at the third unsuccessful attempt.
-
2. Re: execute javascript captivate 7
Shirin_B Sep 16, 2013 10:47 PM (in response to RodWard)Hi,
I tired with the javascript and advance action, but none of them worked, but I chose show function and displayed the right answer in that way and it worked for me, but I really wanna know why Captivate is not responding to a simple Javascript!!! or a simple conditional action?!?
Is this due to having some back end problem with Captivate 7? Cause executing a simple Javascript shouldn't be a problem.
Thanks
-
3. Re: execute javascript captivate 7
RodWard Sep 16, 2013 10:58 PM (in response to Shirin_B)If you're trying to execute JS code from Captivate on your local hard drive then you need to have the publish folder location set up as a trusted location in Flash Global Security.
See this page for details:
http://www.infosemantics.com.au/adobe-captivate-troubleshooting/how-to-set-up-flash-global -security
-
4. Re: execute javascript captivate 7
Suresh Jayaraman Sep 17, 2013 12:17 AM (in response to Shirin_B)Hi
It worked .. used the same option "Top" . The script is below just simple alert w/o any script of function
alert ("Test")
It worked for both SWF and HTML 5 in Chrome and Fire Fox
Thanks
Suresh J
-
5. Re: execute javascript captivate 7
Lilybiri Sep 17, 2013 1:29 AM (in response to Shirin_B)Hi,
I wil not talk about the JavaScript, but about your advanced action (many users know why).
FIrst question: are you pointing to attempts on Quiz or on Question level? Because the quizzing system variable cpQuizInfoAttempts is only on Quiz level, not on question level. It will be incremented each time the user uses the Retake button on the Results/Score slide. This means, it is incremented when the third attempt starts.
Supposing you were pointing at Quiz level: your condition 'IF cpQuizInfoAttemtps is greater than 3' will NEVER result in True, because once the attempts are exhausted the value of that variable will be stuck at 3. And moreover you want this to be done when the third attempt is on, not when it is over. So, try to change your condition to
'IF cpQuizInfoAttemtps is equal to 3'
Maybe my descriptive list for system variables in CP6 could help. I didn't update it for 7 at this moment but only a few variables were added.
http://blog.lilybiri.com/system-variables-in-captivate-6
Lilybiri
-
6. Re: execute javascript captivate 7
Suresh Jayaraman Sep 17, 2013 3:51 AM (in response to Lilybiri)Lieve , expect review variable very soon !
-Suresh
-
7. Re: execute javascript captivate 7
Lilybiri Sep 17, 2013 6:41 AM (in response to Suresh Jayaraman)Suresh, here I was not talking about that long expected Review variable. I tried to explain that the system variable cpQuizInfoAttempts is not meant for attempts on Question level (we miss a system variable there as well ) but on Quiz level. And really, will welcome the Review variable as I would a lot more variables. Will be very happy to update my system variables list.
Lieve
-
8. Re: execute javascript captivate 7
Shirin_B Sep 17, 2013 5:20 PM (in response to Lilybiri)Hi Lilybiri,
So you mean, I can't use advance actions for short answer quizzes?
Actually, I tried what you suggested and it didnt work for short answers.
Cheers,
-
9. Re: execute javascript captivate 7
Lilybiri Sep 18, 2013 12:42 AM (in response to Shirin_B)I think you didn't read my answer quite well, because you don't answer my questions. That system variable will not track attempts on Question level, only on Quiz level. This has nothing to do with the type of question! And from what I understand you want to check the question attempts, not the quiz attempts. So your advanced action:
- will not do what you want on question level
- has a faulty condition because cpQuizInfoAttempts will never become greater than the maximum number of attempts on quiz level
Why not use the Failure levels as Rod suggested in his first answer? That would be much easier...
Lilybiri
-
10. Re: execute javascript captivate 7
Shirin_B Sep 19, 2013 10:43 PM (in response to Lilybiri)Hi,
It is a quiz.
And I already set it up invisible in output and visible after the last attempt and it works but...
Here what I need to know is that, is my Captivate faulty for not running the a simple code or this is the way Captivate 7 has been designed.
Thanks,
-
11. Re: execute javascript captivate 7
dwhmet Jul 24, 2014 7:40 PM (in response to Shirin_B)I have a similar problem. i.e. a simple "Hello World" javascript wont execute when called from Captivate 8 upon a button click. I've tried testing using the In Browser and HTML5 in browser options. I know the button click is triggering success as I have the success message being displayed. I can get the button to do other things on success, like play an audio etc... but it won't run the javascript on success.
I had a look at the Flash site regarding security and added my test folder as a trusted location, but it did not help. Adobe - Flash Player : Settings Manager - Global Security Settings panel Not sure that is relevant for JavaScript anyway. I just want to test javascript in Captivate 8 but it seems difficult to make it run.
Any advice to fix this basic problem appreciated. -
12. Re: execute javascript captivate 7
RodWard Jul 24, 2014 8:16 PM (in response to dwhmet)Upload your content to a web server and test from there. There can be other cross-domain security sandbox issues in addition to Flash Global Security that can interfere with this. Viewing the content from a web server is the best way to test it.
-
13. Re: execute javascript captivate 7
dwhmet Jul 25, 2014 12:18 AM (in response to RodWard)I did try that, however unfortunately I get the same result. i.e. the JavaScript does not run. Uploaded it as a SCORM package to Moodle 2.7. The SCORM package runs and the button triggers a success event, but the "Hello World" JavaScript associated with the button on the form simply does not seem to execute when the button is clicked. I'm wondering if its a local browser security or scripting security issue.
-
14. Re: execute javascript captivate 7
RodWard Jul 25, 2014 1:47 AM (in response to dwhmet)What does your JavaScript code look like? Where have you placed it?
-
15. Re: execute javascript captivate 7
David-OZ Jul 28, 2014 10:19 PM (in response to RodWard)Rod I've tried a few snippets from the web such as below. I placed it in the ACTIONS Script window Area
<!DOCTYPE HTML>
<html>
<body>
<p>Header...</p>
<script>
alert('Hello, World!')
</script>
<p>...Footer</p>
</body>
</html>
Thanks,
David -
16. Re: execute javascript captivate 7
RodWard Jul 28, 2014 10:27 PM (in response to David-OZ)OK. For starters, you should not be putting all this code into the Script window. The better way to do JS code in Captivate is to insert your functions in one of the JS files that Captivate will publish automatically and then just call the function from the Script window. You can find the default JS template files in the Captivate install directory.
However, I heartily recommend that you head over to Jim Leichliter's website at CaptivateDEV.com and purchase his excellent video course on Captivate Javascript. A little education will save you a lot of time and headaches.
-
17. Re: execute javascript captivate 7
David-OZ Jul 28, 2014 11:36 PM (in response to RodWard)OK Rod I will follow up. So what's this Script_Window for then? Isn't it supposed to be able to run complete javascript code from the script window? NOTE: I now have it working, by removing all the html code. Thus now all I have is;
alert('Hello, World!')
Which works ok in the Script_Window when previewed in the "In Browser" mode. It is a bit slow though. Takes about 5 seconds to run after clicking the button.
-
18. Re: execute javascript captivate 7
RodWard Jul 28, 2014 11:52 PM (in response to David-OZ)The script window is quite limited in terms of what you can do there. For example, you cannot even add comments in the code in the script window or it will break the code.
So if you REALLY want to get stuck into JS code in Captivate you need to know the stuff in Jim's excellent course.
-
19. Re: execute javascript captivate 7
David-OZ Aug 6, 2014 12:04 AM (in response to RodWard)Ok managed to get a function call working by placing it in utilities.js, but really this all seems rather messy to implement. Every time you publish a project it overwrites the utilities.js file with a fresh copy, so you have to re-apply the custom functions you placed in that file. Captivate just doesn't seem setup properly for javascript integration.
How would I go about including html? i.e. where does the html go?
I'm trying to get this simple line graphics demo script working from within Captivate 8. Assuming the javascript goes in a function in the utilities.js, but what about the html?
<canvas id="myCanvas" width="200" height="100"
style="border:1px solid #000000;"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);
</script>




