Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny: dynamic default value for textInput

Tags:

r

shiny

I see that textInput has a default value field. However, I can't seem to figure out how to dynamically set the default value field. Lets say I have a selectInput, I want the default value of my textInput to be the value selected in selectInput but with some text appended to it, which the user can freely edit.

On the ui side where I have the textInput I obviously can't do anything like value=paste0(output$selectName,"_someText") because I can't use output.

I'm guessing the answer involves some code on the server side that updates the textInput. I can't seem to figure how to get updateTextInput to do what I want, even though it sounds like what I want. Any advice on dynamically generating a default value for a textInput would be appreciated.

Regards

like image 677
Carl Avatar asked Sep 02 '25 17:09

Carl


1 Answers

It appears that I needed to use observe in the server side and then updateTextInput worked.

like image 155
Carl Avatar answered Sep 04 '25 08:09

Carl