Asking multiple questions in one task (different input types)

Hi! Just tried to run your code and got it to work fine :slightly_smiling_face: The only problems were:

  1. The "javascript" currently can't be overwritten by the block, so you have to add it in the "config". So basically, it didn't run before, which is why nothing happened. (Also make sure you don't have any "javascript" value in your prodigy.json btw, otherwise you'd override the recipe config.)
  2. There's no need to run document.querySelector('#is_wcl_checkbox').checked = false at the beginning here – this would only run once anyways, before Prodigy is mounted, and result in an error (because the checkbox isn't there yet). If you want to make sure that the checkbox is rerendered every time a new task comes in, the easiest way is to add an HTML attribute that changes for every task – e.g. by adding a property like key that's populated by a variable unique to the task. For example, key="{{_task_hash}}" uses the task hash, which we know is always unique.
HTML_TEMPLATE = '<input key="{{_task_hash}}" type="checkbox" id="is_wcl_checkbox" /><label for="is_wcl_checkbox">Is bias by word choice and labeling regading highlighted subject (how it is described, not what)?</label>'
1 Like