# Slider - prevent empty responses using button

**URL:** <https://discourse.psychopy.org/t/slider-prevent-empty-responses-using-button/35312>\
**Category:** Coding\
**Created:** [June 9, 2023, 3:50am UTC](https://discourse.psychopy.org/t/slider-prevent-empty-responses-using-button/35312 "2023-06-09T03:50:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LuisaZ](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@LuisaZ](https://discourse.psychopy.org/u/LuisaZ)\
**Post date:** [June 9, 2023, 3:50am UTC](https://discourse.psychopy.org/t/slider-prevent-empty-responses-using-button/35312/1 "2023-06-09T03:50:46Z")

</div>

Hi there,

I’m using the slider component in my experiment. Participants are allowed to make multiple changes after giving the first rating. Once they are ready for the next trial, they can press a “continue” button using the mouse. I noticed that participants can skip the trial without giving a rating by pressing the continue button, is there any code that can prevent that?

I know the code for using the space bar to end the trial, but I’m not sure how it can be changed to fit in my experiment.

 ![Screen Shot 2023-06-09 at 1.47.26 pm](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/8/58abe3029326e6512a373b3ba881c9c067991315.jpeg)  
 ![Screen Shot 2023-06-09 at 1.48.16 pm](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/d/c/dc87001d9d99214f2ccfbe96e9cd829379413b6e.jpeg)  
 ![Screen Shot 2023-06-09 at 1.48.35 pm](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/3/1/31d82a54312e9945350592edc26c3ce571b3ddde.jpeg)

Any help would be appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [June 9, 2023, 8:05am UTC](https://discourse.psychopy.org/t/slider-prevent-empty-responses-using-button/35312/2 "2023-06-09T08:05:00Z")

</div>

Hello

does this work for you?

> [@Making Button Appear only after Slider Ratings](https://discourse.psychopy.org/t/making-button-appear-only-after-slider-ratings/27720):
>
> OS: Win11 PsychoPy version: 2022.1.1 What are you trying to achieve?: I currently have a routine containing five sliders and a “Next Button”. I want the next button to appear only when the participant has made ratings on all five of the slider scales. This prevents participants from simply clicking through the screens by spamming the Next button without actually making any ratings What did you try to make it work?: I have already managed to make this work by typing the following into the St…

alternatively you could try if setting the **start time** of your button to **condition** instead of a **time** and use **slider.rating** as the condition.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![LuisaZ](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@LuisaZ](https://discourse.psychopy.org/u/LuisaZ)\
**Post date:** [June 9, 2023, 10:31am UTC](https://discourse.psychopy.org/t/slider-prevent-empty-responses-using-button/35312/3 "2023-06-09T10:31:09Z")

</div>

Hi Jens, the code suggested in the post didn’t work for me but using slider.rating as condition worked! Thank you so much!!
