管理对话框和谷歌表格 iframe

添加一个名为 showGoogleForm 的新功能,并根据以下代码进行调整。请注意,为简单起见,此示例不包含应在生产环境中添加的任何错误检查。

该网址应如下所示: https//docs.google.com/forms /…/?usp = p_url&entry.1739103583 = labelel1

  var showGoogleForm = function (e) {
    var url = e.currentTarget.googleFormsURL
    url = url.replace('labelname1', 'Some prefilled value')
    url = url.replace('labelname2', 'Another prefilled value')

    // Add the iFrame dynamically to avoid popup issue
    jQuery('<iframe id="#googleform" src="" width="100%" height="100%" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>').appendTo('#googleformparent')    

    // Set the prefilled url as the iFrame source
    jQuery('#googleform').attr('src', url)

    // Remove the iframe element when the user closes the dialog to avoid the popup if the user did not submit the form.
    jQuery('#dialogclose').click(function(e) {
        jQuery('#googleform').remove()        
    })

  }