sd_server()
accepts a new argument use_cookies
, defaults to TRUE
. It enables cookies so that reopening the survey will resume the participant to where the survey was left. The database will trace to the original session_id
and continuous the data update based on user input. If changed to FALSE
, the survey will start as brand new session upon reopening.preview_data.csv
. This file works exactly the same as online database, and is compatible with cookies functionality.sd_server()
. You can trigger it by: sd_server(language = "zh-CN")
.language
argument in sd_server()
. Custom language messages can be further modified by providing a translations.yml
file in the root project folder.sd_create_translations()
function to generate a template translations.yml
file to use to edit the system messages.ctb
)is_matrix
metadata was not recorded for matrix sub-questions when exported into the _survey/questions.yml
file, which caused an error if any matrix question was required. This is now corrected when obtaining the question structure from the stored _survey/questions.yml
file.sd_update()
function.sd_deploy()
function.sd_output()
to now be able to output the chosen question values, chosen question option label(s), and the question label itself. Addresses feature request #128.sd_update()
now directly force update the package without checking for version difference anymore.sd_is_answered()
function to check if a question is answered or not and returns TRUE
or FALSE
accordingly. For "matrix"
type, only if all sub-questions are answered will it be marked as TRUE
.sd_add_question()
now has a chunk
argument, if TRUE
it will include the outer chunk wrapper. Default is FALSE
.matrix
question type now will have its root question id shown in the data sheet. This id is essential in other logic, for example it can be used as a handle for the sd_show_if()
logic. This root id is also removed from the all_question_required
logic, since it's only a handle and doesn't provide option to answer.use_html
argument in sd_server()
. Now the survey.qmd file will always be rendered when the app runs only if one of two conditions are met: 1) the survey.html file is not detected, or 2) the survey.html file is outdated. Otherwise, it will use the rendered survey.html file.auto_scroll
now works better and smoother.text
, textarea
, numeric
, select
, date
, and daterange
.auto_scroll
changed to FALSE
by default.check_skip_show()
checks, so you'd get an error that the question id was invalid.sd_server()
accepts a new parameter called "rate_survey"
, default to FALSE
. If TRUE
, the Exit button will trigger a rating question. If FALSE
, the Exit button will only trigger a double confirmation to ensure the user really wants to exit.sd_close()
function call.session_id
, time_start
, time_end
, and exit_survey_rating
. There could be more in the future.sd_output()
function will take care of the styling setting of reactive questions. For example, sd_output(id = "some_question_id", type = "question", width = "80%")
will define with of 80% for a reactive question.sd_show_if()
can take care of cross-page conditional reactive questions.sd_server()
now has a new parameter called auto_scroll
. It's default to TRUE
, which enables auto scrolling that tracks the user's input, can be turned off by changing to FALSE
. Thanks to the contribution from Zain Hoda.sd_question()
now has the "matrix"
type. The documentation page is updated.sweetalert
.sd_completion_code()
function.sd_output()
with type = 'value'
argument. Previously only question values could be displayed in the UI with sd_output()
.sd_add_question()
to instantly create a question template. Defaults to type of "mc"
but also accepts all other types ("text"
, "textarea"
, "numeric"
, etc.). The function call will delete itself after running.sd_add_page()
to instantly create a page template. Make sure to run this function outside any division or code chunk. The function call will delete itself after running.database_uploading()
so only the changed fields get written, and also the writing happens after checking the show_if
conditions (addresses #100).refresh_interval
argument in sd_get_data()
as defaulting to NULL
, which means the data will not be reactively fetched, regardless of the context it is used in. The data will only continuously refresh if sd_get_data()
is called within a reactive context and refresh_interval > 0
.sd_set_password()
to not print out user's password and provide clearer instructions.sd_show_password()
added to show a stored password. The user will be prompted to double confirm that they want to show it. If there is no password, the user will be prompted so, along with a message of using sd_set_password()
to create the password.sd_ui()
function to set placeholders for the shiny app ui.skip_if
and show_if
works, removing skip_if_custom
and show_if_custom
. Now they work similar to the case_when()
function, where you provide the formula condition ~ target
for each condition in either function. These are also provided globally inside the server()
function using sd_skip_if()
and sd_show_if()
."survey.qmd"
.sd_include_folder()
function so users can add a folder to the shiny resource path.images
, js
, css
, and www
folders as well as folders to quarto files to the shiny resource path when the package loads.sd_next()
works to improve page navigation and ensure that each sd_next()
button has a unique id based on the current page.sd_create_survey()
changed to sourcing template directly from the package. Two parameters are provided. The first parameter is path
, which defines the relative path of the target. If left blank, the path will be the current working directory. The second parameter is structure
, which defines which structure of the template the user wants to choose, default as "single"
and can be changed to "multi"
.sd_deploy()
as a wrapper function of rsconnect::deployApp()
to deploy the survey.sd_update()
as a replacement of sd_update_surveydown()
to update the package.sd_version()
as a replacement of sd_check_versions()
to check for the current version and the latest version.sd_close()
function to create a close button for the survey.<br>
above the Next button anymore. The Next buttons can now be in the same chunk as the questions as spacing has been added.sd_store_value()
. There used to be a problem if a value is a list with multiple entries. Now they are collapsed with commas due to the application of format_question_value()
on the value
variable.reactive
argument for sd_get_data()
. Now all functions that should be compatible with both reactive (server) and static (ui) conditions will automatically match, without necessity of explicitly specifying them.sd_redirect()
updated with a parameter called newtab
, defaults to FALSE
. If TRUE
, the redirection link will be opened in a new tab. If used together with delay
, the new tab might be blocked by the browser after count-down, but the user click will not be blocked.database_uploading()
function to secure it from possible SQL injection attacks.sd_server()
for efficiency; converted local data storage to lists instead of data frames.session_id
as the leading column, and removed the respondent_id
column.sd_redirect()
to create redirection to external links, either by providing a button, a countdown, or both. This function can be called both in the survey body and the server chunk.sd_get_url_pars()
to reactively get the parameters in the URL.sd_next()
and sd_redirect()
both support the "Enter" key for a better user experience.sd_database()
.sd_output()
function that replaces the original sd_display_question()
(by specifying type = "question"
) and sd_display_value()
(by specifying type = "value"
). The original 2 functions are depreciated and will be removed in future updates. If sd_output()
is only used with "id"
specified, it works the same as shiny::uiOutput()
.sd_database()
, now db_name
is changed to dbname
, and table_name
is changed to table
, for consistency with Supabase, and simplicity of parameter names.sd_database()
will also prompt "If you have verified all connection details are correct but still cannot access the database, consider setting the gssencmode
parameter to "disable"
in the sd_database()
function." We don't encourage users to disable gssencmode
, since it's more secure to have it on, but if users encounter with connection error, this will be a possible solution.sd_server()
function in the last update that affected numeric questions being determined as answered or not, that is now fixed.sd_display_value()
was used multiple times on different question IDs, it could only fetch the last user input. Now it's fixed.inst/quarto/filters
from surveydown.lua
to sd_main.lua
and updated the extension v0.2.5 to call this via a more robust, cross-platform approach.sd_wrapper.lua
to avoid naming conflict. Now the extension is only used as a wrapper. The sd_main.lua
and related CSS and JS files are all in the R package.sd_store_value()
and sd_copy_value()
to the server.R file (these are server operations).respondent_id
variable that tracks the respondent based on their starting the survey.jhelvy
to surveydown-dev
in version control functions.page_id
and question_id
, the survey will stop and show error.sd_get_data()
with a reactive
argument to enable reactive data fetching.sd_question()
now has a reactive
argument to enable reactive questions, and sd_question_reactive()
was removed.sd_admin_enable()
internal, changed to admin_enable()
.sd_admin_ui()
and sd_add_admin()
from the package.SUPABASE_PASSWORD
environment variable, but it should be SURVEYDOWN_PASSWORD
.sd_get_data()
and works.show_if_custom
logic was not working for multiple conditions, now it does.skip_if_custom
logic could error if a condition was NULL
(fixed with isTRUE()
).sd_config()
, items were being assigned with the <-
operator, causing them to be deleted when the thing being assigned was NULL
. Now changed to =
.sd_display_value()
for displaying a question value based on the question id
.sd_copy_value()
for making a copy of a question value, which may be needed if you need to display something more than once since you can't make more than one object with the same id
.sd_reactive_output()
to sd_display_question()
.sd_store_value()
works to avoid a global environment, and changed the arg name from name
to id
.sd_add_admin()
function to react to admin_page condition, if set to true an 'Admin' page will be created for survey creators.sd_admin_ui()
function to create the UI for the Admin page button..lua
file and the css styles.sd_config()
as a separate required_questions
argument, instead of being defined in sd_question()
.sd_question_reactive()
and sd_reactive_output()
.sd_store_value()
function to store variables into the database. For example, sd_store_value(respondentID, "respID")
will store the value of respondentID
into a column named "respID"
. If the name is not provided, the column will be named as its original variable name, in this case, respondentID
.timestamp
column in the beginning of the result dataframe.sd_database()
function added with pause
argument default to FALSE
. If pause = FALSE
, database will be properly connected; if pause = TRUE
, a local CSV will be generated and survey results will be stored there.sd_config()
function has preview
removed due to pause
in sd_database
.pause = FALSE
(aka default), warning messages will be shown for missing or incorrect password, and will prompt the usage of sd_set_password()
.admin_page
argument in config.R
.sd_set_password()
function to set the supabase password as the survey environment variable. This function takes in a string, which should be your supabase password. We recommend you to only run it in the R Console so that your password does not appear in the .qmd
file.sd_set_password()
, an .Renviron
file will be created in your survey project root directory. In this file, SUPABASE_PASSWORD=your_password
will be created, with your_password
being whatever your input of sd_set_password()
. Then, .Renviron
will be added to your .gitignore
file to avoid being pushed to GitHub..Renviron
file, SUPABASE_PASSWORD=your_password
will be concatenated to the end. If there is already a definition of SUPABASE_PASSWORD
, it will be overwritten. If there is no .gitignore
file, it will be created. If there is already an .Renviron
in .gitignore
, it won't be duplicated.sd_set_password()
once to define supabase password for your survey project. It takes care of the rest of necessary operations, and you can rerun sd_set_password()
to change the password, with the previous value safely overwritten.sd_database
, a gssencmode
argument is added and set to "prefer" by default. In some cases, local deployment may fail due to network environments such as VPN settings. It can be solved by setting gssencmode = "disable"
in the survey qmd
file.example.qmd
survey has instructions for supabase configuration and shinyapps deployment..gitignore
file has .Renviron
included. This file will store supabase password and is essential for shinyapps deployment. Eliminating this file from pushing to GitHub will ensure that your password is only saved locally.create_survey()
changed to sd_create_survey()
for function name consistency.sd_update_extension()
function to update the surveydown Quarto extension.sd_check_versions()
function to check the version of both the R package and the Quarto extension. If any of them don't match with the latest version, there will be a suggestion to run the sd_update_surveydown()
function.sd_update_surveydown()
function to update both the R package and the Quarto extension.theme
command using the bootswatch themes or a custom scss
file.backgroundcolor
.mc_button
and mu_multiple_buttons
types of questions are now centered.surveydown::create_survey()
function will download the whole extension repo, containing the extension, an example survey, and an RStudio project.show_if
can be applied to multiple options of the same question, which allows users to have more than one option in a question that triggers the revealing of a hidden question.required
argument in sd_question()
, which allows users to force a question to be required. If not answered, a popup window blocks the user from continuing to the next page.Initial version!