Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ website:

- section: "Interactivity"
contents:
- text: "Accessing Question Values"
href: docs/accessing-values.qmd
- text: "Conditional Logic"
href: docs/conditional-logic.qmd
- text: "Reactivity"
Expand Down Expand Up @@ -152,6 +154,8 @@ website:
href: templates/random_options.qmd
- text: "Random Options Predefined"
href: templates/random_options_predefined.qmd
- text: "Option Shuffling"
href: templates/option_shuffling.qmd

- section: "Reactivity"
contents:
Expand Down
8 changes: 6 additions & 2 deletions blog/2025-11-21-announcing-surveydown-version-1/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ survey-settings:
use-cookies: no
auto-scroll: no
rate-survey: no
all-questions-required: no
all-required: no
start-page: your_first_page
system-language: en
highlight-unanswered: yes
highlight-color: gray
capture-metadata: yes
required-questions: []
required: []

system-messages:
cancel: Cancel
Expand Down Expand Up @@ -245,6 +245,10 @@ In this case, the value stored in the data will be automatically converted to sn
| Dark Green | `dark_green` |
| Bright Red | `bright_red` |

::: {.callout-caution}
This snake case conversion is **removed** after `v1.1.0`, in which if you provide a single vector of labels, the values stored in the database will be exactly the same as the labels shown to respondents.
:::

## What's Next?

This `v1.0.0` release marks a major milestone for `surveydown`, but we're not stopping here. We have exciting features planned for future releases. Stay tuned!
Expand Down
7 changes: 7 additions & 0 deletions chunks/sdvalue.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
::: {.callout-note}

The `sd_value()` function returns the chosen value or values for one or more questions. It is a reactive function and can only be used inside the `server()` function in your **app.R** file.

See the [Accessing Question Values](accessing-values.qmd) page for details on how to use `sd_value()`.

:::
12 changes: 3 additions & 9 deletions chunks/skip-if.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
While basic page navigation is handled using `sd_nav()`, you can override this static navigation in your server function with the `sd_skip_if()` function to send the respondent to a forward page based on some condition.
While basic page navigation is handled automatically (or with the `sd_nav()` function for more fine-tuned control), you can override this static navigation in your server function with the `sd_skip_if()` function to send the respondent to a forward page based on some condition.

A common example is the need to **screen out** people based on their response(s) to a question. Let's say you need to screen out people who do not own a vehicle. To do this, you would first define a question in your **survey.qmd** file about their vehicle ownership, e.g.:

Expand Down Expand Up @@ -26,17 +26,11 @@ Sorry, but you are not qualified to take our survey.

Then in the server function in the **app.R** file, you can use the `sd_skip_if()` function to define the condition under which the respondent will be sent to the target `screenout` page, like this:

::: {.callout-note}

The `input` object is a Shiny object that stores each question `id` defined by `sd_question()` in your **survey.qmd** file, so whenever referring to a question in a condition, you must use the format `input$question_id`.

:::

```{r}
server <- function(input, output, session) {

sd_skip_if(
input$vehicle_ownership == "no" ~ "screenout"
sd_value("vehicle_ownership") == "no" ~ "screenout"
)

# ...other server code...
Expand All @@ -48,6 +42,6 @@ You can provide multiple conditions to the `sd_skip_if()` function, each separat

> `<condition> ~ "target_page_id"`

In the example above, `input$vehicle_ownership == "no"` is the condition, and `"screenout"` is the target page that the respondent will be sent to if the condition is met.
In the example above, `sd_value("vehicle_ownership") == "no"` is the condition, and `"screenout"` is the target page that the respondent will be sent to if the condition is met.

Take a look at the [Common Conditions](conditional-logic.html#common-conditions) section for examples of other types of supported conditions you can use to conditionally control the survey flow.
Loading