Using Mechanical Turk for the first time. Here is a template of what I am trying to do:
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>
<crowd-form id="form" answer-format="flatten-objects">
<p id="code"></p>
<crowd-input name="exit-code" placeholder="paste answer here" required></crowd-input>
</crowd-form>
<script>
// Reference to input .csv form
code_var = ${codes};
document.getElementById("code").innerHTML = code_var;
$("#form").submit( function(eventObj) {
$("<crowd-input />").attr("type", "hidden")
.attr("code", code_var)
.appendTo("#form");
return true;
});
</script>
The two things I want that are not happening:
- The codes are not being displayed in the
<p>
tag. If I do<p id="code">${codes}</p>
then it does work. - I want to submit both the code from ${codes} and the exit code on form submission. But I cannot figure out how to do that.
Thank you for any hints or advice!