Picture of Henrik Aabom
Temporarily disable component completion
by Henrik Aabom - Friday, 24 August 2018, 8:13 AM
 

Hello everyone!

Is there a way to temporarily disable the user’s ability to complete a component?

I.e. I have an extension that should disable the “inview” completion of a graphic component. The extension’s javascript is running on component prerender.

Thank you very much in advance.

Picture of Matt Leathes
Re: Temporarily disable component completion
by Matt Leathes - Tuesday, 28 August 2018, 11:47 AM
 

No easy way I can think of...

Picture of Henrik Aabom
Re: Temporarily disable component completion
by Henrik Aabom - Tuesday, 28 August 2018, 12:38 PM
 

Ok, thanks anyway.

We stumbled upon these two, but can't seem to make it work. Do you know how they work and if they can even be used for an extension like the one I describe?

https://github.com/adaptlearning/adapt_framework/wiki/Adapt-API

https://github.com/adaptlearning/adapt_framework/pull/694

Picture of Matt Leathes
Re: Temporarily disable component completion
by Matt Leathes - Tuesday, 28 August 2018, 1:58 PM
 

I don't think it would work for the purposes of temporarily disabling inview completion; the problem is one of how to re-enable inview later on... the inview listener is removed as soon as the inview conditions are met, regardless of whether the component did actually get marked as completed or not.

Picture of Henrik Aabom
Re: Temporarily disable component completion
by Henrik Aabom - Wednesday, 29 August 2018, 6:49 AM
 

That makes total sense.

Thank you, Matt, I'll go with my plan B of "disabling" the ability to complete components, i.e. temporarily removing the component from the DOM with CSS, which seems to work fine so far.

Picture of Matt Leathes
Re: Temporarily disable component completion
by Matt Leathes - Wednesday, 29 August 2018, 8:56 AM
 

that does sound like the simplest way of getting at least close to what you want...