% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/survey_module.R
\name{survey_module_server}
\alias{survey_module_server}
\title{Shiny module server for an embedded survey}
\usage{
survey_module_server(id, instrument, on_submit = NULL)
}
\arguments{
\item{id}{A character string matching the \code{id} passed to
\code{\link[=survey_module_ui]{survey_module_ui()}}.}

\item{instrument}{An \code{sframe} object, or a \code{reactive} that returns one.
Changing the reactive value resets the survey.}

\item{on_submit}{Optional function of one argument. Called immediately
after submission with the response list. Useful for writing to a
database or sending an email without waiting for an
\code{\link[shiny:observeEvent]{shiny::observeEvent()}} elsewhere in the app.}
}
\value{
A \code{reactive} that returns \code{NULL} before submission and the
response list after.
}
\description{
Renders the survey instrument and collects the respondent's answers.
Returns a \code{reactive} that holds \code{NULL} until the form is submitted, then
returns the response as a named list (one element per visible item).
}
\examples{
\donttest{
# See survey_module_ui() for a complete example.
}
}
\seealso{
\code{\link[=survey_module_ui]{survey_module_ui()}}
}
