# Blocks interface required fields

**URL:** <https://support.prodi.gy/t/blocks-interface-required-fields/4745>\
**Category:** Uncategorized\
**Tags:** usage, custom, solved\
**Created:** [October 1, 2021, 5:44am UTC](https://support.prodi.gy/t/blocks-interface-required-fields/4745 "2021-10-01T05:44:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdddog](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/jdddog/32/2296_2.png) [@jdddog](https://support.prodi.gy/u/jdddog)\
**Post date:** [October 1, 2021, 5:44am UTC](https://support.prodi.gy/t/blocks-interface-required-fields/4745/1 "2021-10-01T05:44:50Z")

</div>

Is it possible when using the blocks interface, to make sure that the user has to fill in a specific view before the answer can be accepted?

For instance, to make sure that the user chooses an option in the choice view before clicking accept?

```python
blocks = [
        {"view_id": "choice"},
        {"view_id": "text_input", "field_id": "comments", "field_rows": 1, "field_label": "Comments"},
]

```

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [October 1, 2021, 3:42pm UTC](https://support.prodi.gy/t/blocks-interface-required-fields/4745/2 "2021-10-01T15:42:26Z")

</div>

Hi! It sounds like what you're looking for is the `validate_answer` callback: [https://prodi.gy/docs/custom-recipes#validate\_answer](https://prodi.gy/docs/custom-recipes#validate_answer) It lets you add a function to your recipe that receives the JSON data of the current task and lets you raise custom errors – for example, if `"comments"` is empty. The error message will then be shown in an alert and the annotator can only submit the answer if they fix it and it passes validation 🙂

---

<div class="post-metadata">

**Author:** ![jdddog](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/jdddog/32/2296_2.png) [@jdddog](https://support.prodi.gy/u/jdddog)\
**Post date:** [October 2, 2021, 1:02am UTC](https://support.prodi.gy/t/blocks-interface-required-fields/4745/3 "2021-10-02T01:02:55Z")

</div>

Thanks Ines, that's exactly what I needed 🙂
