按钮提交R有光泽

use*_*940 5 r input submit shiny

我正在尝试实现一个表单来上传文件,但是当我点击提交按钮时开始做操作,问题是有一个奇怪的错误,我不知道它是什么,我做了一个例子教程,它没有问题,现在我实现相同,但使用index.html,它不起作用.

错误是:"if(输入$ uploadFasta == 0)返回错误(NULL):参数长度为零"

我的index.html是这样的:

<form class="span12 menu-med-upload">
    <div class="row-fluid">
        <center>
          <div class="custom-input-file btn btn-inverse">
            <input type="file" size="1" id="fileFasta" class="input-file" />
          </div>
        </center>
        <button id="uploadFasta" type="button" class="btn action-button shiny-bound-input" >go!</button>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

我的server.R就像:

output$table <- renderText({
    if(input$uploadFasta == 0)
        return(NULL)
    myRenderTable()
})
Run Code Online (Sandbox Code Playgroud)

有人知道这是什么问题,谢天谢地,如果这个话题以前开过,我就找不到了.

Joe*_*eng 2

操作按钮是一个自定义输入绑定,我敢打赌它不会被加载。

在与 server.R 相同的目录中添加一个 global.R 文件,并使其包含以下内容:

addResourcePath(
    prefix='actionbutton', 
    directoryPath=system.file('actionbutton', 
                          package='shinyIncubator'))
Run Code Online (Sandbox Code Playgroud)

然后在您的index.html中,添加以下内容<head>

<script src="actionbutton/actionbutton.js"></script>
Run Code Online (Sandbox Code Playgroud)

(与往常一样,请确保有一个明确的结束</script>标记 - 不要使用<script />。)