1

我想知道是否有一种方法可以使用带有 React JS 的 amazon sdk 从我自己的 Web 应用程序提交 Amazon Mechanical Turk 命中。我可以通过我的网站将其显示为 HTML 表单,并使用https://www.mturk.com/mturk/externalSubmit进行提交。这是我的表单和来自 xml 的示例。

  showHit() {
    var current='';
    var currentHit = this.state.hit;
    if(Object.keys(this.state.hit).length === 0){
      console.log('no select')
    } else {
      console.log(currentHit['HIT'])
      document.getElementById('output').innerHTML = Object.values(currentHit['HIT'])
    }
  }

里面我的返回输出。

<p id="output"></p>
<script>{this.showHit()}</script>
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
            <HTMLContent><![CDATA[
                <!DOCTYPE html>
            <html>
            <head>
                <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
                <script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
            </head>
            <body>
                <form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
                <input type='hidden' value='' name='assignmentId' id='assignmentId'/>
                <h1>Example Question</h1>
                <img src={image} alt="alternatetext"> 
                
                <fieldset id= "div1" required>
                <label for= 'question1'> 1. Is this current content component a scientific figure or a table?</label><br>
                <select name = "question1" id = "question1" required>
                <option disabled selected value>Select an option</option>
                <option id="figure">Figure</option>
                <option id="table">Table</option>
                </select>
                <button onclick="myFunction()">confirm</button>
                <br>
                <br>
                
                
                <label for= 'question2'> 2. Is this current content component cropped correctly?</label><br>
                <select name = "question2" id = "question2" required>
                <option disabled selected value>Select an option</option>
                <option value="yes">Yes</option>
                <option value="no">No</option>
                </select>
                <br>
                <br>
                

                <label for= 'question3-4'> 3-4. Is this <a id = 'name'></a> labeled correctly?</label><br>
                <script>
                    function myFunction(){
                        if (document.getElementById("figure").selected){
                            name = "figure";
                        } else if(document.getElementById("table").selected){
                            name = "table";
                        } else{
                            name = "[CONFIRM QUESTION 1]"
                        }
                        document.getElementById("name").innerHTML = name;
                }
                </script>
                <select name = "question3-4" id = "question3-4" required>
                <option disabled selected value>Select an option</option>
                <option value="yes">Yes</option>
                <option value="no">No</option>
                </select>
                <br>
                <br>

                <label for= 'question5'> 5. What are the <b>explicit</b> meta-tags of this current content component </label><br>
                <input name = "question5" id = "question5" required></input>
                <br>
                <br>

                <label for= 'question6'> 6. What are the <b>implicit</b> meta-tags of this current content component </label><br>
                <input name = "question6" id = "question6" required></input>
                <br>
                <br>
                
                <p><input type='submit' id='submitButton' value='Submit' /></p></form>

                </fieldset>

                <script language='Javascript'>turkSetAssignmentID();</script>
            </body>
            </html>
            ]]>
            </HTMLContent>
                <FrameHeight>450</FrameHeight>
            </HTMLQuestion>

我的问题是,当我点击提交时,我被定向到以下错误

提交此 HIT 的结果时出现问题。

此 HIT 仍分配给您。要再次尝试此 HIT,请刷新页面。如果此问题仍然存在,您可以通过单击上方的“HIT 详细信息”,然后单击弹出窗口底部的“联系此请求者”来联系此 HIT 的请求者。

要返回此 HIT 并继续处理其他 HIT,请单击页面右侧顶部或底部的“返回”按钮。

我唯一可能的想法是,当我提交时,我不知何故需要使用 assignmentID 和可能的 workerID,但是当我在自己的网页上托管问题时,我不知道如何获取这些。

感谢您的任何帮助!

4

0 回答 0