1

I am playing around with Rook and googleVis in an attempt to produce some interactive charts

I currently have an HTML text box where users can input a date to trigger changes

res <- Rook::Response$new()
res$write('<input type="text" name="theDate">')

I want to replace this with a combobox

res$write('<input type="dropdown" name="theDate">')

populated by an R vector similar to this

displayDates <- c("12 Mar 1980" ,"19 Mar 1980")

It is like a decade since I have done any of this HTML stuff and I'm also just beginning with Rook

rcs
  • 67,191
  • 22
  • 172
  • 153
pssguy
  • 3,455
  • 7
  • 38
  • 68

1 Answers1

2

Maybe something like this:

library(Rook)
dates <- c("12 Mar 1980" ,"19 Mar 1980")

app <- function(env){
    req <- Rook::Request$new(env)
    res <- Rook::Response$new()
    res$write('<select>')
    res$write(paste("<option>", dates , "</option>"))
    res$write('</select>')
    res$finish()
}

s <- Rhttpd$new()
s$launch(name="myapp", app=app)
johannes
  • 14,043
  • 5
  • 40
  • 51
  • looks good. I really should have also asked how I reference the selected item for subsequent use as a variable – pssguy Oct 15 '12 at 17:06