Blocks interface required fields

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?

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

Thanks for your help!

Hi! It sounds like what you're looking for is the validate_answer callback: 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 :slightly_smiling_face:

Thanks Ines, that's exactly what I needed :slight_smile:

1 Like