如何在Google表单中添加动态字段?

时间:2012-08-29 12:38:53

标签: javascript jquery google-apps-script google-form

Google表单中是否有任何功能 Add New Field using jQuery Add fields using Javascript

我正在使用谷歌应用程序脚本创建问卷调查应用程序,我的管理员面板将设置问题和答案(管理员决定将有多少问题)。如果表单旁边有一个(+)可以自动加载表单下面的另一个文本框,那将是完美的。

3 个答案:

答案 0 :(得分:2)

我找到了完美的原因,为什么它无法使用Google表单添加动态字段,因为Google表单应用程序完全与电子表格绑定

所有表格都有单独的电子表格。

因此,由于与电子表格密切相关,因此无法在Google表单中生成动态字段。

我们可以说Google Forms和Spreadsheets之间的静态关系。

答案 1 :(得分:2)

我认为您希望构建一个可以使用jQuery和Google Spreadsheets Data API使用jQuery提交到Google电子表格的新页面

答案 2 :(得分:0)

简短回答

是的,您可以使用表单服务Class Form

以编程方式创建/编辑表单

注意:目前无法根据用户输入更改表单/问题,例如进行级联下拉菜单。

扩展答案

以下是将每种问题类型添加到Google表单的具体方法。

Method                      Return type             Brief description
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
addCheckboxItem()           CheckboxItem            Appends a new question item that allows the respondent to select one or more checkboxes, as well as an optional "other" field.
addDateItem()               DateItem                Appends a new question item that allows the respondent to indicate a date.
addDateTimeItem()           DateTimeItem            Appends a new question item that allows the respondent to indicate a date and time.
addDurationItem()           DurationItem            Appends a new question item that allows the respondent to indicate a length of time.
addGridItem()               GridItem                Appends a new question item, presented as a grid of columns and rows, that allows the respondent to select one choice per row from a sequence of radio buttons.
addListItem()               ListItem                Appends a new question item that allows the respondent to select one choice from a drop-down list.
addMultipleChoiceItem()     MultipleChoiceItem      Appends a new question item that allows the respondent to select one choice from a list of radio buttons or an optional "other" field.
addParagraphTextItem()      ParagraphTextItem       Appends a new question item that allows the respondent to enter a block of text.
addScaleItem()              ScaleItem               Appends a new question item that allows the respondent to choose one option from a numbered sequence of radio buttons.
addTextItem()               TextItem                Appends a new question item that allows the respondent to enter a single line of text.
addTimeItem()               TimeItem                Appends a new question item that allows the respondent to indicate a time of day.

另见