Copy link to clipboard
Copied
Hello there,
I added a smart shape button on a question slide. I want it to be active when an answer selection checkbox is clicked, till then I want it to stay deactivated. Is it possible please??
Thank you...
Copy link to clipboard
Copied
There is no run-time event available from selection of an answer option that you could use to trigger an Advanced Action that SHOWs or ENABLEs a button on the Quiz Slide.
You'd need some kind of custom programming or a specialized widget to pull this off, but those quiz answer captions do not have Object Names that can easily be referenced by a widget to trigger an event.
Copy link to clipboard
Copied
Thank you RodWard. Lilybiri, to be specific, I'm aiming to show the correct answer info text with that button after the selection was made before moving to the next question...
Thank you both..
Copy link to clipboard
Copied
Yes it's pretty obvious where you'd be going with this but the fact remains, you don't have an event you can use to make something happen. Without that you're stuck.
Copy link to clipboard
Copied
Each action, and disabling/enabling a shape button is an action, has to be triggered by an event.
On question slides you only have the On Enter event, and the Success/Last Attempt events. The last events occur after the two-step process for Submitting, not after a selection of an answer. If you explained the goal of that button, maybe another approach could be possible? I explained some use cases for shape buttons on question/score slide in this article:
http://blog.lilybiri.com/want-a-button-on-question-slide-in-captivate
If you want to see a complete list with available events out of the box in Captivate:
Copy link to clipboard
Copied
If you are using html5 you can include this JavaScript or insert it in the head of the html document.
There is a function call ed myClick where you can show or enable the button. Just put the smartshape button name in the quotes:
var interfaceObj, eventEmitterObj;
window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();
});
function initializeEventListeners()
{
if ( interfaceObj )
{
if ( eventEmitterObj )
{
eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
{
if ( window.cpInQuizScope )
{
res = cp.model.data.project_main.slides.split( ',' );
cSlide = res[ window.cpInfoCurrentSlide - 1 ];
thisSlide = cp.model.data[ cSlide ];
for ( var i = 0; i < thisSlide.si.length; i++ )
{
if ( cp.model.data[ thisSlide.si[ i ].n ].hasOwnProperty( 'qdi' ) )
{
var temp = cp.model.data[ thisSlide.si[ i ].n ].qdi.toString();
document.getElementById( temp ).addEventListener("click", myClick);
}
}
}
function myClick( e )
{
cp.show( 'smartshape_btn' );
cp.enable ( 'smartshape_btn' );
}
});
}
}
}
Copy link to clipboard
Copied
Thank you very much but I am not that much capable of the program...
Copy link to clipboard
Copied
If you don't want to use JS as TLCMediaDesign suggested, you'll have to change your strict requirement to have this happening when an answer on a default question slides is clicked. Quiz slides have pretty strict rules, there are some workarounds as I describe in several blog posts, but what you want is not possible because clicking on an answer is not an 'event' as both Rod and myself explained. Either you accept that only clicking on the Submit button will make it possible to show the 'correct answer', either using the default Feedback messages, either by using custom objects as I explained in this blog post:
http://blog.lilybiri.com/question-question-slides-in-captivate
Another approach is to create custom question slides: you use standard objects like text containers, buttons/shape buttons, variables and advanced actions. Each answer will be clickable if it is an interactive object, which means you have a Success event and can show/enable whatever you want. Beware: reporting to a LMS will be a little bit more complicated, but it is possible.
Copy link to clipboard
Copied
All you need to do is to copy and paste the code and change the name to your smartshape name here in bold:
function myClick( e )
{
cp.enable ( 'smartshape_btn' );
}
It would look like this in the html file, all of the new code is bold:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1'/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=10">
<title></title>
<style type="text/css">#initialLoading{background:url(assets/htmlimages/loader.gif) no-repeat center center;background-color:#ffffff;position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;z-index:10010;}</style>
<script>
var interfaceObj, eventEmitterObj;
window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();
});
function initializeEventListeners()
{
if ( interfaceObj )
{
if ( eventEmitterObj )
{
eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
{
if ( window.cpInQuizScope )
{
res = cp.model.data.project_main.slides.split( ',' );
cSlide = res[ window.cpInfoCurrentSlide - 1 ];
thisSlide = cp.model.data[ cSlide ];
for ( var i = 0; i < thisSlide.si.length; i++ )
{
if ( cp.model.data[ thisSlide.si[ i ].n ].hasOwnProperty( 'qdi' ) )
{
var temp = cp.model.data[ thisSlide.si[ i ].n ].qdi.toString();
document.getElementById( temp ).addEventListener("click", myClick);
}
}
}
function myClick( e )
{
cp.enable ( 'smartshape_btn' );
}
});
}
}
}
function initializeCP()
Copy link to clipboard
Copied
I really like to thank you all for your help. I decided to have a review quiz option active. Thank you all again...
Copy link to clipboard
Copied
My dear friends, as I mentioned I decided to have “review quiz” option to be active. but I need each question has a separate feedback while being reviewed. On either preferences/quiz settings/quiz review messages window, or question slide options/accessibility I couldn’t make it. Help will be appreciated. Thanks.
Copy link to clipboard
Copied
That will be a bit more work. Should the feedback depend on the wrong/correct status or also on the given answer?
The idea is to create a conditional (shared) action to be triggered On Enter for each Question slide. That event is available. The condition checks if you are in Review mode, which is possible using the system quizzing variables cpInReviewMode (Boolean). You show the proper feedback only in Review mode. However it is much easier to use the feedback text containers (caption or shape, depending on your settings) during the quiz itself.
Copy link to clipboard
Copied
Dear Lilybiri, thaks again. I want the user to answer the question and than see the feedback of the correct answer ( the info about why being correct ). you mentioned that it is much easier to use a container while taking the quiz itself but I needed a button to be activated after the selection was made (from the getgo) Anyway, I will try your shared action solution while reviewing.
I couldn’t understand why accessibility option on question slides doesn’t work. It is there but doesn’t work.
Thank you very much.
Copy link to clipboard
Copied
Thank you very much again Lilybiri. Shared action worked perfectly...