1

I've been struggling with this issue in the last 2 days and nothing seems to work for me so far.

What I want this piece of code to do: user click searchButton, an empty data frame is created.

eventReactive works fine for me on normal UI.R but when I tried to use index.html it doesn't work. My code is below:

Server.R:

new_search <- eventReactive(input$searchButton, {
        search_term <<- input$searchText
test <- data.frame()
})

Index.html

<!-- Search bar -->
  <form class="sidebar-form">
                <div class="input-group">
                  <input id="searchText" type="text" class="form-control" placeholder="Ask me anything..">
                  <span class="input-group-btn">
                    <button id="searchButton" type="button" class="btn btn-flat action-button">
                      <i class="fa fa-microphone"></i>
                    </button>
                  </span>
                </div>
  </form>

Please help :( Thank you so much

edit: my html template is from here: https://onepagelove.com/creative

I added the following code to the header section:

<!-- Shiny JS -->
<script src="shared/jquery.js" type="text/javascript"></script>
<script src="shared/shiny.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="shared/shiny.css"/>
  • I tried your code and added `observe({input$searchButton; print("works") })` to my `server.R` and it prints it every time I click the button, maybe post your `index.html` header etc and your full `server.R` code. – NicE Jan 28 '16 at 10:07
  • i tried your suggestions and it prints 'works' every time I launch the application.. so doesn't really work for me in the sense that I want it to work when I click my button. i have updated my question with my full html link as you suggested. Thank you so much – Poochinblack Jan 28 '16 at 10:29
  • what if you do `observe({input$searchButton; print(new_search()) })`. When I add this below the code you posted in your post I seed `data frame with 0 columns and 0 rows` only when I print the button. – NicE Jan 28 '16 at 10:38
  • Thank you so much. This works perfectly – Poochinblack Jan 31 '16 at 07:53

0 Answers0