什么时候做" choice_id"和" other_id"出现与否?

时间:2018-02-19 12:04:39

标签: surveymonkey

我曾经看过" choice_id"在答案中。  这是一个用于"其他(请注明)" (为保密而编辑的数字)

Question "id": "988.....",
"answers": [{"choice_id": "1039......."},
{"text": "I had this problem",
"other_id": "1039......"}]

现在我的回复没有choice_id

{"id":"2420.....","answers":[{"text":"my text response here","other_id":"1712......"}]},

为什么缺少choice_id? " is_answer_choice"在调查细节中是正确的:

{"id":"1712......","visible":true,"is_answer_choice":true,
"apply_all_rows":false,
"text":"Other (please specify)",
"position":0,"num_chars":50,
"error_text":"Please enter a comment.",
"num_lines":1},"choices":[...etc...

1 个答案:

答案 0 :(得分:0)

如果您有一个问题,即有3个选项的单一选项以及允许开放式答案启用的选项,那么您有3个选择和另一个选择 - 它们的模型不同。

因此,如果用户提交选择常规选择的响应,则响应正文如下所示:

{
    "id": "123",
    "answers": [
        {
            "choice_id": "313"
        }
    ]
}

但是如果用户选择"其他"选择并提出一个开放式的回应,身体看起来像这样:

{
    "id": "123",
    "answers": [
        {
            "text": "My open ended response",
            "other_id": "314"
        }
    ]
}

在调查详情中,您还应该看到如下内容:

"answers": {
    "other": {
        "id": "110",
        "text": "Other (please specify)",
        ...
    },
    "choices": [
        {
            "visible": true,
            "text": "a",
            "position": 1,
            "id": "111"
        },
        {
            "visible": true,
            "text": "b",
            "position": 2,
            "id": "112"
        },
        {
            "visible": true,
            "text": "c",
            "position": 3,
            "id": "113"
        }
    ]
}

其中显示的另一个选择与答案选项的建模方式不同。 is_answer_choice中的other选项实际上只是一个显示选项。如果值为false,那么在用户界面中,它会显示为问题下方的评论框,如果是true,则会在列表中显示其他选项。