问题描述
我正在尝试实现一个上载文件的表单,但是当我单击提交"按钮时开始执行操作,问题是有一个奇怪的错误,我不知道这是什么,我做了本教程的示例,它可以正常工作,现在我正在使用index.html来实现相同的功能,但它不起作用.
I'm trying to implement a form to upload a file, but start to do operation when I click on a submit button, the problem is that a have a strange mistake and I don't know what's it, I made the example of the tutorial and it worked without problem, now I'm implementing the same but with index.html and it don't work.
错误是:如果(input $ uploadFasta == 0)return(NULL)时出错: 参数的长度为零".
The mistake is:"Error in if (input$uploadFasta == 0) return(NULL) : argument is of length zero"
我的index.html就像:
my index.html is like:
<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>
我的server.R就像:
my server.R is like:
output$table <- renderText({
if(input$uploadFasta == 0)
return(NULL)
myRenderTable()
})
有人知道出了什么问题,谢谢大家,如果这个话题以前没被打开过,但我找不到,对不起.
somebody know what's the problem, and thank for all and sorry if this topic was open before but I could not find.
推荐答案
操作"按钮是自定义输入绑定,我敢打赌它没有被加载.
Action button is a custom input binding and I'll bet it's not being loaded.
在与server.R相同的目录中添加global.R文件,并使其包含以下内容:
Add a global.R file in the same directory as server.R, and have it contain this:
addResourcePath(
prefix='actionbutton',
directoryPath=system.file('actionbutton',
package='shinyIncubator'))
然后在您的index.html中,将以下内容添加到<head>
:
Then in your index.html, add the following to <head>
:
<script src="actionbutton/actionbutton.js"></script>
(一如既往,请确保具有明确的结束</script>
标记-请勿使用<script />
.)
(As always, be sure to have an explicit closing </script>
tag--don't use <script />
.)
这篇关于按钮提交带有光泽的R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!