# Slider does not end routine

**URL:** https://discourse.psychopy.org/t/slider-does-not-end-routine/6481
**Category:** Online experiments
**Created:** [January 28, 2019, 8:18pm UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481 "2019-01-28T20:18:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jakob](https://discourse.psychopy.org/u/jakob)
#### Post date: [January 28, 2019, 8:18pm UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/1 "2019-01-28T20:18:35Z")

</div>

Hi,  
I set ‘Force end of Routine’ in the Slider Component but in the online Experiment after clicking on the scale the routine is not ended. in the standalone version on my mac it works. Any ideas? I am using v3.0.2

url: [https://pavlovia.org/run/vertrautheit/experiment/html/](https://pavlovia.org/run/vertrautheit/experiment/html/)

---

<div class="post-metadata">

### Author: ![kevinhroberts](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@kevinhroberts](https://discourse.psychopy.org/u/kevinhroberts)
#### Post date: [January 29, 2019, 11:30pm UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/2 "2019-01-29T23:30:48Z")

</div>

Hi Jakob,

I’ve experience this issue too. For now, if you want to end the routine when the user click on the slider, add a code component to your slider’s routine, and on the “Each Frame” tab, put this in the Javascript code:

```auto
if (slider.getRating() !== undefined) {
      continueRoutine = false
      slider.status = PsychoJS.Status.FINISHED
}

```

[slider\_example.psyexp](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/2X/9/9c2e537d5a8d98c87f0dc83b5ef99b873f714d30.psyexp) (16.1 KB)

Check out the attached .psyexp. You can take a look at the result online at [slider\_example [PsychoPy]](https://pavlovia.org/run/kevinhroberts/slider_example/html/)

---

<div class="post-metadata">

### Author: ![jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jakob](https://discourse.psychopy.org/u/jakob)
#### Post date: [January 30, 2019, 11:08am UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/3 "2019-01-30T11:08:21Z")

</div>

Thank you! Works perfectly

---

<div class="post-metadata">

### Author: ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)
#### Post date: [January 30, 2019, 11:09am UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/4 "2019-01-30T11:09:22Z")

</div>

Thanks Kevin, and we’ll make sure the code is correctly output (like that) from Builder in the next release

---

<div class="post-metadata">

### Author: ![jakob](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jakob](https://discourse.psychopy.org/u/jakob)
#### Post date: [January 30, 2019, 3:00pm UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/5 "2019-01-30T15:00:53Z")

</div>

Another issue i found is that after calling slider.setReadOnly() the Slider is greyed out but it is still possible to set the value.

---

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [January 30, 2019, 3:19pm UTC](https://discourse.psychopy.org/t/slider-does-not-end-routine/6481/6 "2019-01-30T15:19:31Z")

</div>

> [@jon](#):
>
> we’ll make sure the code is correctly output (like that) from Builder in the next release

Yes, this was already in the JS code compiler for Slider, however was commented out as I was replicating the Slider demo code. See [BF: Reactivate forceEndRoutine for Slider. by dvbridges · Pull Request #2244 · psychopy/psychopy · GitHub](https://github.com/psychopy/psychopy/pull/2244) for pull req.
