闪亮 - 如何在不使用密码输入的情况下将文本输入中的字符替换为***?
我在ShinyApp中使用TextInput。 当用户写时,我想看到 - “ ****” - 喜欢密码字段, 但是我不想使用passwordInput,如何仅使用textInput?
if (interactive()) {
ui <- fluidPage(
textInput("caption", "Caption", "Data Summary"),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({ input$caption })
}
shinyApp(ui, server)
}
I use textInput in my shinyapp.
When the user write I want to see - "****" - like password field,
but I don't want to use passwordInput, How can I do it with using only textInput ?
if (interactive()) {
ui <- fluidPage(
textInput("caption", "Caption", "Data Summary"),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderText({ input$caption })
}
shinyApp(ui, server)
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以定义一个自定义函数:
基于: https:// https:// github.com/rstudio/shiny/blob/main/r/input-password.r
请注意,此实现几乎与
passwordInput
(请参阅: https:https:// /github.com/rstudio/shiny/blob/main/r/input-password.r ),此外输入还将恢复。You could define a custom function:
Based on: https://github.com/rstudio/shiny/blob/main/R/input-password.R
Note that this implementation would be almost identical to
passwordInput
(see: https://github.com/rstudio/shiny/blob/main/R/input-password.R), besides that input would be restored.没有
passwordInput()
进行更新textInputicon(来自ShinyWidgets)
改编自Heres https://i.sstatic.net/5ipzi.png“ rel =“ nofollow noreferrer”>
第一个答案:
使用
passwordInput()
来自 htttps:https:// shiny.rstudio.com/reference/shiny/1.6.0/passwordinput.html
Update without
passwordInput()
Adapted from heres TextInputIcon (from Shinywidgets) with password entry
First answer:
Use
passwordInput()
From https://shiny.rstudio.com/reference/shiny/1.6.0/passwordInput.html