Custom conditions for moving to the next page #202
Replies: 8 comments 8 replies
-
|
Perhaps you are looking for https://surveydown.org/docs/conditional-logic#conditional-forward-page-skipping |
Beta Was this translation helpful? Give feedback.
-
|
We also documented other �ways to control navigation here |
Beta Was this translation helpful? Give feedback.
-
|
OK, but I'm looking to prevent people from moving forward. So could I set
the page target as the page I don't want the user to be able to leave until
they meet the condition?
…On Mon, Jun 2, 2025 at 11:50 AM John Helveston ***@***.***> wrote:
Perhaps you are looking for
https://surveydown.org/docs/conditional-logic#conditional-forward-page-skipping
—
Reply to this email directly, view it on GitHub
<#202 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACTVVOMEFDKOOJC36NNO3N33BRXDTAVCNFSM6AAAAAB6NKTMC2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMZUGU2TANI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
|
Ah okay so this is like the opposite of We have internal logic for this kind of prevention in the The only question I have is what the function name should be. Maybe sd_require_condition(
condition ~ page_id
)I'm thinking of this name because we currently use |
Beta Was this translation helpful? Give feedback.
-
|
Yes it would be something like sd_require_condition. Adding this in would make the platform remarkably flexible because any type of arbitrary validation could be added to a page.
The only other thing is perhaps it would be good to pass a string for a pop-up if the condition fails. This isn’t as necessary for skipping forward, but if the user gets stuck failing a validation check, it’d be great to inform them. Could be done separately by adding a reactive function to the next button, too (but involves additional coding etc).
Robert Kubinec
Assistant Professor of Political Science
Department of Political Science
University of South Carolina
… On Jun 2, 2025, at 1:26 PM, John Helveston ***@***.***> wrote:
Ah okay so this is like the opposite of sd_skip_foward(). With skipping we send someone to a forward page based on a condition being met. In your case, you want to prevent someone from being able to move foward until some condition is met. We don't have that natively supported yet, but we can probably add it following a similar to how we have designed sd_skip_foward(), where you would give a condition ~ target pattern. In this case, the target would be the page you're not allowed to leave until the condition is met.
We have internal logic for this kind of prevention in the sd_server() already with required questions <https://surveydown.org/docs/server-options.html#required-questions>. This prevents the respondent from going forward until the question is answered. So you're just asking for the ability to set some other condition. I think we can figure this out.
The only question I have is what the function name should be. Maybe sd_require_condition() or sd_require_question()? Like:
sd_require_condition(
condition ~ page_id
)
I'm thinking of this name because we currently use required_questions as the argument name in sd_server() to require a question be answered.
—
Reply to this email directly, view it on GitHub <#202 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACTVVOMO4CHZFUGR4YTQ6B33BSCKXAVCNFSM6AAAAAB6NKTMC2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMZUGYZTONA>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
|
Also unrelated (perhaps I could do a different feature request), but I think it’d be really useful to have some kind of reactive div or counter for the user answering questions. As in when a page loads, there’s a black box around each unanswered question, then when they select an answer, the black box disappears. That way they’d know when it was answered or not.
Robert Kubinec
Assistant Professor of Political Science
Department of Political Science
University of South Carolina
… On Jun 2, 2025, at 1:30 PM, Bob K ***@***.***> wrote:
Yes it would be something like sd_require_condition. Adding this in would make the platform remarkably flexible because any type of arbitrary validation could be added to a page.
The only other thing is perhaps it would be good to pass a string for a pop-up if the condition fails. This isn’t as necessary for skipping forward, but if the user gets stuck failing a validation check, it’d be great to inform them. Could be done separately by adding a reactive function to the next button, too (but involves additional coding etc).
Robert Kubinec
Assistant Professor of Political Science
Department of Political Science
University of South Carolina
> On Jun 2, 2025, at 1:26 PM, John Helveston ***@***.***> wrote:
>
>
> Ah okay so this is like the opposite of sd_skip_foward(). With skipping we send someone to a forward page based on a condition being met. In your case, you want to prevent someone from being able to move foward until some condition is met. We don't have that natively supported yet, but we can probably add it following a similar to how we have designed sd_skip_foward(), where you would give a condition ~ target pattern. In this case, the target would be the page you're not allowed to leave until the condition is met.
>
> We have internal logic for this kind of prevention in the sd_server() already with required questions <https://surveydown.org/docs/server-options.html#required-questions>. This prevents the respondent from going forward until the question is answered. So you're just asking for the ability to set some other condition. I think we can figure this out.
>
> The only question I have is what the function name should be. Maybe sd_require_condition() or sd_require_question()? Like:
>
> sd_require_condition(
> condition ~ page_id
> )
> I'm thinking of this name because we currently use required_questions as the argument name in sd_server() to require a question be answered.
>
> —
> Reply to this email directly, view it on GitHub <#202 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACTVVOMO4CHZFUGR4YTQ6B33BSCKXAVCNFSM6AAAAAB6NKTMC2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMZUGYZTONA>.
> You are receiving this because you authored the thread.
>
|
Beta Was this translation helpful? Give feedback.
-
|
Hi @jhelvy , I have just open a new discussion around this same topic. I need to validate the answer of a text-based question before letting the user continue to the next question. I couldn't make it work with conditionals so this would be very helpful. In addition to the required answer, a condition that can be provided as a custom function. |
Beta Was this translation helpful? Give feedback.
-
|
Hi folks, we just bumped surveydown to v0.13.2 adding the new feature of It's not on CRAN yet so please install the latest version using: pak::pak("surveydown-dev/surveydown", ask = FALSE)A more inclusive discussion and reasoning flow can be accessed in issue #216 . Feel free to check our document and templates for this updated conditional logic. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
At present it's impossible to add custom validation conditions before moving to the next page. I can write an observer on the next button but I can't prevent the page ID to be set to the new value because that's done in the sd_server function.
My proposal is that sd_server takes a named list of boolean reactive values with one value for each page ID; before moving to the next page, the relevant code in the sd_server function would check for TRUE for that reactive value for that page ID. That way custom validation functions could be written for each page that would go beyond required answers (especially as, see my issue, sliders don't really fit into required questions etc.)--without adding unnecessary complexity to the underlying code base.
Beta Was this translation helpful? Give feedback.
All reactions