How to test condition for textbox usng a conditional panel

rstudio

#1

Hi
I am working on the code below. Everything works fine except for the statement.

 "output.displayEnterButton == ' true' "

What condition do I have to test in order to determine that there is input in the box and therefore the "enterBtn" button should be displayed? By the way, I used backtick to format the code, but It does not seem to be totally formatted. Please advice.

Thanks,

ui <- fulidPage(
  conditionalPanel(
        condition = "output.displayTheSaveButton  > '0'",
        textInput("textbox", h5(strong("Please enter name/s to designate combined set/s separated by comma only - No spaces")))),
        #verbatimTextOutput("caption"),
      conditionalPanel(
        condition = "output.displayEnterButton == 'true'",
        actionButton("enterBtn", "Enter names")
      )
)
server <- function(input, output, session){
   output$displayEnterButton <- reactive({
          req(input$textbox)
         return(input$textbox)
       })
       
       outputOptions(output, "displayEnterButton", suspendWhenHidden = FALSE)
                     
       observeEvent(input$enterBtn, {
         req(input$textbox)
         result <- glycoPipe(input$textbox)
       })
}

#2

I'm not sure I understand your code completely, but if you want the enter button to be shown if something is typed in the textbox you can do something like this.

library(shiny)
ui <- fluidPage(
      textInput("textbox", h5(strong("Please enter name/s to designate combined set/s separated by comma only - No spaces"))),
    conditionalPanel(
    condition = "input.textbox",
    actionButton("enterBtn", "Enter names")
  )
)
server <- function(input, output, session){  }

shinyApp(ui, server)

#3

@giuseppa.cefalu

To format your code there are two main tricks:

  1. Wrap your single line code in single tick marks.
  • Text:
    This is my `shinyApp(ui, server)`
  • Output:
    This is my shinyApp(ui, server)
  1. You can format multi line code with triple tick marks
  • Text
This is my shiny app
```
ui <- fluidPage()
server <- function(...) {}
shinyApp(ui, server)
```
  • Output:

This is my shiny app

ui <- fluidPage()
server <- function(...) {}
shinyApp(ui, server)

(If for some reason your code contains the same number of backtick marks used to highlight the code, you can wrap your code in at least one more backtick mark.)


#4

Thank you for reviewing my formatting and answering my question