title: Show a chart based on a condition
body: <p>I have the following code, where you can enter a string, click a button and get a result depending on the string entered:</p>
  <pre><code># ui.R
  
  ui &lt;- fluidPage(
      conditionalPanel(
          &quot;input.btn_input === 0&quot;,
          textInput(&quot;caption&quot;, &quot;Caption&quot;, &quot;abc&quot;),
          actionButton(&quot;btn_input&quot;, &quot;Enter&quot;)
      ),
      conditionalPanel(
          &quot;input.btn_input !== 0&quot;,
          style = &quot;display: none;&quot;,
          verbatimTextOutput(&quot;value&quot;)
      )
  )
  
  # server.R
  
  server &lt;- function(input, output) {
      
      Response &lt;- eventReactive(input$btn_input, {
          v &lt;- input$caption
          if (v == &quot;xxx&quot;) {
              # Allow to use the chart
          } else {
              &quot;Error&quot;
          }
      })
      
      output$value &lt;- renderPrint({
          Response()
      })
  }
  </code></pre>
  <p>Now, instead of <code># Allow to use the chart</code> I want to insert the chart contained in the Shiny example, that is:</p>
  <pre><code>ui &lt;- fluidPage(
  
      titlePanel(&quot;Old Faithful Geyser Data&quot;),
  
      sidebarLayout(
          sidebarPanel(
              sliderInput(&quot;bins&quot;,
                          &quot;Number of bins:&quot;,
                          min = 1,
                          max = 50,
                          value = 30)
          ),
  
          mainPanel(
             plotOutput(&quot;distPlot&quot;)
          )
      )
  )
  
  server &lt;- function(input, output) {
  
      output$distPlot &lt;- renderPlot({
          x    &lt;- faithful[, 2]
          bins &lt;- seq(min(x), max(x), length.out = input$bins + 1)
  
          hist(x, breaks = bins, col = 'darkgray', border = 'white')
      })
  }
   
  shinyApp(ui = ui, server = server)
  </code></pre>
  <p>Can anyone suggest me how to do it? The best I have been able to do is show the sidebar panel. Thanks in advance.</p>