Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add choices to a selectInput

Tags:

r

shiny

I have a selectInput with all the possible choices displayed. I want to implement it such that if a user types something in the box and hits enter, that will also be added as a choice.

observeEvent(input$mykeypress, {

if(input$mykeypress == 13){

    print(input$selectBox)

}

I tried the above code to see if my input changed, but it seems that no matter what extra stuff I type in the selectbox, none of it is recognized.

Anyone have ideas as to have I can recognize anything extra that the user types?

Edit: One other idea I am considering is creating a textInput, and prepopulating it with all the values that I used in my selectbox. Is something like that possible?

like image 642
Green Avatar asked Mar 12 '23 12:03

Green


1 Answers

I ended up figuring it out, because the selectizeInput just wraps around selectize.js, in your selectizeInput you can use the argument: options = list(create = TRUE), and the user can add words easily.

like image 88
Green Avatar answered Mar 14 '23 03:03

Green