amazon turk,提交无效
amazon turk, submit is not working
我创建了一个 amazon Turk HIT。
提交 HIT 后。我们总是收到来自人们的电子邮件,告诉我们提交无效...
老实说,我不知道我做错了什么。
我的 HTML 中的表单:
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<div class="inputs">
<label class="input-green"><input name="EXISTS" type="radio" value="YES" id="ckeck-yes">YES</label>
<label class="input-red"> <input name="EXISTS" type="radio" value="NO" id="ckeck-no">NO</label>
</div>
<input type="hidden" name="IMG_ID" value="${Img_ind}">
<input type="hidden" id="assignment_id" name="assignmentId" value=""/>
<p class="text-center"><input type="submit" id="submitButton" class="btn btn-primary" value="Submit"></p>
</form>
Javascript:
<script type='text/javascript'>
var checkedYes = document.getElementById('ckeck-yes');
var checkedNo = document.getElementById('ckeck-no');
window.onload = function() {
var submitButtons = document.getElementById('submitButton');
// Get the Assignment ID, which will be added to your URL by Mechanical Turk.
var assignment_id = location.search.match(/assignmentId=(\w+)/)[1];
document.getElementById("assignment_id").value = assignment_id;
// Assignment ID "ASSIGNMENT_ID_NOT_AVAILABLE" of indicates preview mode. Warn worker.
if( assignment_id == "ASSIGNMENT_ID_NOT_AVAILABLE" ) {
submitButtons.disabled = true;
document.getElementById("click_accept_warning").style.display = "block";
}
// Get the Submit URL, which will be added to your URL by Mechanical Turk. */
var submit_to_url_base = (location.search.match(/turkSubmitTo=([^=&]+)/)||[])[1];
if(submit_to_url_base) {
document.getElementById("mturk_form").action = submit_to_url_base + "/mturk/externalSubmit";
}
if(submitButtons) {
submitButtons.setAttribute('onclick', 'return validateForm()');
}
};
function validateForm() {
if(checkedYes.checked == false && checkedNo.checked == false) {
alert("Please select the most matching result!");
return false;
}
return true;
}
</script>
我错过了什么?
问题是 amazon turk 用 http%3A%2F%2F 替换了我的 http://
所以我创建了一个新命中,检查新命中 javascript 并从亚马逊示例中复制了 2 个 javascript 函数。
function decode(strToDecode) {
var encoded = strToDecode;
return unescape(encoded.replace(/\+/g, " "));
};
function turkGetSubmitToHost() {
return decode(turkGetParam("turkSubmitTo", "https://www.mturk.com"));
};
var form = document.getElementById("mturk_form");
if (form) {
form.action = turkGetSubmitToHost() + "/mturk/externalSubmit";
}
谢谢
我创建了一个 amazon Turk HIT。 提交 HIT 后。我们总是收到来自人们的电子邮件,告诉我们提交无效...
老实说,我不知道我做错了什么。
我的 HTML 中的表单:
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<div class="inputs">
<label class="input-green"><input name="EXISTS" type="radio" value="YES" id="ckeck-yes">YES</label>
<label class="input-red"> <input name="EXISTS" type="radio" value="NO" id="ckeck-no">NO</label>
</div>
<input type="hidden" name="IMG_ID" value="${Img_ind}">
<input type="hidden" id="assignment_id" name="assignmentId" value=""/>
<p class="text-center"><input type="submit" id="submitButton" class="btn btn-primary" value="Submit"></p>
</form>
Javascript:
<script type='text/javascript'>
var checkedYes = document.getElementById('ckeck-yes');
var checkedNo = document.getElementById('ckeck-no');
window.onload = function() {
var submitButtons = document.getElementById('submitButton');
// Get the Assignment ID, which will be added to your URL by Mechanical Turk.
var assignment_id = location.search.match(/assignmentId=(\w+)/)[1];
document.getElementById("assignment_id").value = assignment_id;
// Assignment ID "ASSIGNMENT_ID_NOT_AVAILABLE" of indicates preview mode. Warn worker.
if( assignment_id == "ASSIGNMENT_ID_NOT_AVAILABLE" ) {
submitButtons.disabled = true;
document.getElementById("click_accept_warning").style.display = "block";
}
// Get the Submit URL, which will be added to your URL by Mechanical Turk. */
var submit_to_url_base = (location.search.match(/turkSubmitTo=([^=&]+)/)||[])[1];
if(submit_to_url_base) {
document.getElementById("mturk_form").action = submit_to_url_base + "/mturk/externalSubmit";
}
if(submitButtons) {
submitButtons.setAttribute('onclick', 'return validateForm()');
}
};
function validateForm() {
if(checkedYes.checked == false && checkedNo.checked == false) {
alert("Please select the most matching result!");
return false;
}
return true;
}
</script>
我错过了什么?
问题是 amazon turk 用 http%3A%2F%2F 替换了我的 http://
所以我创建了一个新命中,检查新命中 javascript 并从亚马逊示例中复制了 2 个 javascript 函数。
function decode(strToDecode) {
var encoded = strToDecode;
return unescape(encoded.replace(/\+/g, " "));
};
function turkGetSubmitToHost() {
return decode(turkGetParam("turkSubmitTo", "https://www.mturk.com"));
};
var form = document.getElementById("mturk_form");
if (form) {
form.action = turkGetSubmitToHost() + "/mturk/externalSubmit";
}
谢谢