表单提交时Dropbox选择器链接未发送到服务器

时间:2013-02-02 23:57:32

标签: forms post dropbox pug

提交表单时,Dropbox选择器的值是服务器上的空字符串。所有其他输入'值在服务器上显示正常。此外,当Dropbox选择器触发成功事件时,alert上会显示正确的链接。

为什么链接没有到达后端?

这是我在Jade中的客户端代码:

extends layout

block styles
block content
    .container
        div#alertStage
        form#shareForm.form-horizontal(method='post', action='/share', enctype='multipart/form-data')
            .control-group
                input(type='text', placeholder='enter class code', name='classCode', required='required')
            .control-group
                input(type='text', placeholder='enter professor', name='professor', required='required')
            .control-group
                textarea(rows='3', placeholder='enter description', name='description', required='required')
            .control-group
                input#db-chooser(type='dropbox-chooser', name='dropboxLink', style='visibility: hidden', data-link-type='preview')
            .control-group
                input#shareSubmit.btn-primary(type='submit', value='Upload')
block scripts
    script(src='https://www.dropbox.com/static/api/1/dropbox.js', id='dropboxjs', data-app-key='kkobu9cjygmh6js')
    script
        $(document).ready(function()
        {
            $('#shareSubmit').on('click', function(e)
            {
                var message = '';
                e.preventDefault();
                //TODO: Validate data
                $('#shareForm').submit();
            });
            document.getElementById("db-chooser").addEventListener("DbxChooserSuccess", function(e) 
            {
                alert("Here's the chosen file: " + e.files[0].link)
            }, false);
        });

1 个答案:

答案 0 :(得分:0)

将此问题报告为错误,现已解决。