Open dheimgartner opened 2 years ago
onValueChanged()
not required to specify name (unless called with survey_json
)survey_json
and pipe-strategy -> in particular if showNavigationButtons("off")
-> doComplete()
html
question -> maybe passed as html to list...?library(shiny)
devtools::load_all()
survey1 <-
survey() %>%
showNavigationButtons("none") %>%
addNewPage("s1p1") %>%
addNewQuestion("text") %>%
title("What's your name?") %>%
name("name") %>%
inputType("text") %>%
addNewQuestion("text") %>%
title("How old are you?") %>%
name("age") %>%
inputType("number") %>%
requiredIf("{name} == Daniel") %>%
onRender(jsCode = "
function(el, x) {
window.survey1 = this;
}
")
survey2 <-
survey() %>%
showNavigationButtons("none") %>%
addNewPage("s2p1") %>%
addNewQuestion("text") %>%
title("How old are you?") %>%
name("age") %>%
inputType("number") %>%
requiredIf("{name} == Daniel") %>%
onRender(jsCode = "
function(el, x) {
window.survey2 = this;
}
")
# TODO: implement custom registered function
# requiredIf("fromSurvey('survey1', {name}) == Daniel) or something like that
ui <- fluidPage(
surveyOutput("survey1"),
HTML("<p>Shiny action</p>"),
surveyOutput("survey2")
)
server <- function(input, output, session) {
output$survey1 <- renderSurvey(survey1)
output$survey2 <- renderSurvey(survey2)
}
shinyApp(ui, server)
Master
.yaml
-> seehtmltools
https://cran.r-project.org/web/packages/htmltools/htmltools.pdfnpm
... right?htmlwidgets::onRender
(and access the returned js object from the binding...dygraphs
for using widget data: https://github.com/rstudio/dygraphs/survey.R
functionsurvey <- function(js_callback)
and then passed tosurvey.js
viax
. See here: https://github.com/rstudio/dygraphs/blob/master/R/callbacks.Rdygraphs
example: https://github.com/rstudio/dygraphs/survey_creator
widget should directly allow to save json somehowsurvey_json
will be serialized when passed to survey.js. Instead of passing it asjson
we could pass it asdata.frame
(of some form) orlist
and then take care of the correct serialization.