- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个名为 addbtn 的 actionButton。单击此按钮时,它将从 textInput 框中获取输入并创建其他 textInput。
当我单击 addbtn 并创建 textInput 框时,需要清除 txtInput 框中的值,以便我可以添加更多 textInput 框。
这是代码:
界面:
ibrary(shiny)
shinyUI(
# Use a fluid Bootstrap layout
fluidPage(
# Generate a row with a sidebar
sidebarLayout(
# Define the sidebar with one input
sidebarPanel(
sliderInput("capacity", "Current Capacity:",
min=0, max=100, value=10),
c(list(
textInput("service", "Application Component Name", ""),
actionButton("addbtn", "Add Component"))),
#lapply(seq(10), function(i) uiOutput(paste0("ui", i)))
br(),
br(),
br(),
br(),
br(),
actionButton("calcbtn", "Calculate Projection")
),
# Create a spot for the barplot
mainPanel(
textInput("inputWork","Volume", width="200px"),
textInput("inputGrowth","Growth Rate", width="100px"),
lapply(seq(10), function(i) uiOutput(paste0("ui", i)))
#tags$p("Web"),
#verbatimTextOutput("input_type_text")
)
)
)
)
server <- function(input, output)
{
observeEvent(input$addbtn, {
n <- isolate(input$addbtn)
if (n == 0) return()
# create n-th pair of text input and output
output[[paste0("ui", n)]] <- renderUI(
list(textInput(paste0("textin", n), isolate(input$service)),
textOutput(paste0("textout", n))))
updateTextInput(input$service, "Application Component Name", value="")
})
}
使用这段代码,我得到了这些错误:
Warning: Error in $: $ operator is invalid for atomic vectors
Stack trace (innermost first):
64: updateTextInput
63: observeEventHandler [C:\shiny\bcl/server.R#11]
1: shiny::runApp
ERROR: [on_request_read] connection reset by peer
最佳答案
updateTextInput
中的所有问题
帮助
Arguments
session The session object passed to function given to shinyServer.
inputId The id of the input object.
label The label to set for the input object.
value The value to set for the input object.
所以你需要这样的服务器:
shinyServer(function(input, output,session) {
observeEvent(input$addbtn, {
n <- isolate(input$addbtn)
if (n == 0) return()
# create n-th pair of text input and output
output[[paste0("ui", n)]] <- renderUI(
list(textInput(paste0("textin", n), isolate(input$service)),
textOutput(paste0("textout", n))))
updateTextInput(session,"service", "Application Component Name", value="")
})
})
如果你不想改变 textInput
的 label
你可以把它放在 update 中: updateTextInput(session,"service", value="")
关于r - 你如何清除 Shiny 的textInput框中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36286975/
我正在开发一个应用程序,其中日期以 yyyy-mm-dd 形式传递,但向客户端显示为 mm-dd-yyyy(美国客户端)。 我正在使用 jQuery 日期选择器在报告中选择起止日期,并希望将日期显示为
当传递道具可编辑=FALSE时,反应原生更改文本颜色。。如何更改文本输入颜色?我已经阅读了文档https://reactnative.dev/docs/textinput,但没有得到帮助
我有一个 ScrollView 到 TextInput 控件。 单击 TextInput 时,键盘会按预期出现。如果我在 View 区域中的 TextInput 外部单击,键盘
在关闭键盘或按其他地方后,如何摆脱文本输入中的光标? 这就是我所有的 TextInput: 最佳答案 我知道这个问题有点老了,但只要改进 Martin 的回答你就可以做到: componentDid
所以我会试着解释我的场景。 我有一个单行 TextInput .当用户是 onFocus ,文内TextInput可以长于 TextInput本身。 但是,当用户不再onFocus ,Android
这真的很烦人,当我在一个 TextInput 中写入文本时,我点击另一个 TextInput 以在键盘准备好时获得焦点,但它只会隐藏键盘。如何克服这种行为?我只想点击 TextInput 并立即准备好
我想知道在 python 和 Kivy 中是否可以像在 HTML/CSS 中那样自定义 TextInput 小部件。有什么方法可以直接在我的 CustomTextInput(TextInput) 类中
有没有办法做到这一点,如果用户到达 textInput 字段上“行”的末尾,它会在下一行继续并增加文本框的高度,以便他们可以看到他们输入的全部内容?现在,文本继续在同一行上,使首先输入的内容不再可见。
我已经为 TextInput 创建了公共(public)类并多次使用它,但它的事件句柄使用相同的方法。我想在 textInput 中填充数据后处理数组数据。 这里添加了多个textField和单个ha
我是一个新手,无法做出本地 react ,并正在努力解决以下问题。我正在执行更新功能,一旦选择了用户,该用户的数据就会填充到其专用字段 TextInput 中,例如 given_name、family
使用 React Native TextInput,在键盘可见的情况下点击后退按钮(屏幕截图中的红色 1)时,可以稍后编辑 TextInput 值。但是,当点击检查/输入图标(屏幕截图中的红色 2)时
我想要一个输入文本,一旦达到最大值就自动跳转到另一个输入文本字段。 这是示例文本字段。 Identification card: - - 如何让输入的文本字段在第一个文本字段达到最大数量后立即跳
我遇到了这种非常奇怪的行为.. 这是我的代码的简化版本: DOWN = 40; UP = 38; $(document).on("keydown", "#text_input", function(e
当我点击它时,我有一个名为电子邮件或用户名的文本输入,它不显示我键入的值,我认为这是因为屏幕尺寸,无论如何我可以调整 Textinput 以便当我单击它,全文输入显示,我可以看到我输入的值。它下方的其
我的 app.js 中有一个 TextInput ,但它位于页面中间,但我希望它位于页面顶部,我的意思是就在通知栏下方,请问我该怎么做 const BackStyles
我正在尝试使用kv语言重做我已经完成的程序。第一个是用 python 完成的。现在,当我使用 kivy 语言时,我无法从用户界面中获取任何内容。在这个例子中。当条形码文本更改时,它应该更新它的文本属性
我在使用 TextInput 时遇到问题 预期的行为是,当我点击它时,它会聚焦并显示键盘,当我在它周围点击时(除了输入之外的任何地方),TextInput应该模糊并且键盘会消失。目前这不会发生,无论我
我有一个问题,当我在 TextInput 中输入垃圾邮件并单击按钮提交并清除文本时,它变得迟缓并且不会立即清除 TextInput 中的文本。当我在屏幕中有很多内容(如 Lorem Ipsum 文本)
我正在使用函数更新 onChangeText 事件上的 TextInput 值。如果我在函数中状态更新后控制台记录该值,它会打印更新后的值,但不会在输入中显示更新后的值。 errorMessages
在 Powerapp 应用程序中,我有屏幕,其中包含 1:“文本输入”,输入城市名称 2 : 当我点击清除按钮时,如何清除文本输入的值? Click here for more details of
我是一名优秀的程序员,十分优秀!