Javascript 从selectizeInput获取不完整的输入

Javascript 从selectizeInput获取不完整的输入,javascript,r,shiny,selectize.js,Javascript,R,Shiny,Selectize.js,我使用selectizeInput来创建一个自动完成单词列表,如下面的应用程序所示 server <- function(input, output) { output$word <- renderText({ input$selInp }) } ui <- fluidPage( sidebarLayout( sidebarPanel( selectizeInput('selInp', label

我使用selectizeInput来创建一个自动完成单词列表,如下面的应用程序所示

server <- function(input, output) {
    output$word <- renderText({
        input$selInp
    })
}

ui <- fluidPage(
    sidebarLayout(
        sidebarPanel(
            selectizeInput('selInp', label  ='', 
                           selected = 'like',
                           choices = c('like','eat','apples','bananas'))
        ),
        textOutput('word')
    )
)

shinyApp(ui = ui, server = server)

我希望能够做的一件事是接受与选择不匹配的输出。因此,如果我写橙色,我希望能够在文本输出中显示它。有没有办法告诉selectizeInput不要对所需的输入如此挑剔?

我相信您正在寻找创建选项:


这样地?嗯,不完全像我猜的那样,它强迫用户为自己永久地添加它,并且需要一个混乱的鼠标点击添加。确切的意图是注意到用户输入了错误的内容,阅读他们写的内容并告诉他们嘿。我知道你在写,但那不是一个真正的选择。这就是为什么。。。如果您想要selectize不支持的特定内容,尽管这符合原始问题的限制,但您可以寻找支持您所需行为的替代javascript库。一旦找到了想要使用的JS库,将其绑定到shiny中并不需要太多工作
library(shiny)

server <- function(input, output) {
  output$word <- renderText({
    input$selInp
  })
}

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      selectizeInput('selInp', label  ='', 
                     selected = 'like',
                     options = list('create' = TRUE),
                     choices = c('like','eat','apples','bananas'))
    ),
    textOutput('word')
  )
)

shinyApp(ui = ui, server = server)