Complications with showNavigationButtons and goNextPageAutomatic
See original GitHub issueI want to create a mobile-friendly survey that mainly has simple radio button questions and therefore can take advantage of showNavigationButtons: false
and goNextPageAutomatic: true
and allow the user to quickly proceed through the survey, easily answering all the required questions (which show generally just one question per page).
However, if my survey sometimes contains more complicated questions (such as a checkbox question, a string input question, or even a radio question that offers the “Other” string input option), then if showNavigationButtons: false
and goNextPageAutomatic: true
, there needs to be a way (either configurable per page/question or handled automatically somehow) for the nav buttons (or at least the “Next” button) to be forced to show.
Otherwise, a user can get stuck on a question/page that has just a checkbox question and no way to answer it and proceed forward.
See the config below for an example.
I’ve been trying to hack a workaround for this by changing showNavigationButtons
and goNextPageAutomatic
after each question, but I’ve been unable to create a suitable trigger (callback) that fires after the render of each question.
v0.10.4
{
goNextPageAutomatic: true,
requiredText: "",
showQuestionNumbers: "off",
showNavigationButtons: false,
showProgressBar: "top",
completedHtml: '<h4 class="hide">While you wait for that email with your results...</h4>',
locale: 'en',
pages: [
{
name: 0,
questions: [
{
type: "html",
html: '<div class="alert alert-info surveyInstructions">This quick quiz will <b>help you cure your back pain</b> (dynamically adapting based on your responses).</div>',
name: "surveyInstructions"
},
{
title: "How long have you been suffering from back pain?",
name: "duration",
type: "radiogroup",
choices: ['0 to 8 weeks', '8 weeks to a year', 'at least a year'],
isRequired: true,
}
]
},
{
name: 1,
questions: [
{
title: "[From 0 to 5] How strong, flexible, comfortable, and resilient does your back feel nowadays?",
name: "backComfortRating",
type: "radiogroup",
choices: [
{
text: "5: I have the torso of an Olympic athlete.",
value: 5
},
{
text: "4: It feels fine (I don't even think about it).",
value: 4
},
{
text: "3: It bothers me occasionally but usually isn't on my mind.",
value: 3
},
{
text: "2: It often hampers me during various activities that I'd otherwise enjoy.",
value: 2
},
{
text: "1: My back pain prohibits me from MANY activities and seriously disrupts my everyday life.",
value: 1
},
{
text: "0: My back pain is ruining my life!",
value: 0
},
],
isRequired: true,
}
]
},
{
name: 2,
questions: [
{
title: "And have you been examined by a licensed health professional?",
name: "visitedDoctor",
type: "radiogroup",
choices: [
{
text: "Yes",
value: 1
},
{
text: "No",
value: 0
},
],
isRequired: true,
}
]
},
{
name: 3,
questions: [
{
title: "When you followed their recommendations, what happened?",
name: 'resultOfTreatment',
type: "radiogroup",
visibleIf: "{visitedDoctor}=1",
choices: [
{
text: "I felt better.",
value: "better"
},
{
text: "My condition improved temporarily but then reverted.",
value: "temporary"
},
{
text: "No change.",
value: "noChange"
},
{
text: "My situation got WORSE (more pain and/or symptoms).",
value: "worse"
},
{
text: "I chose NOT to follow their recommendations.",
value: "better"
},
],
isRequired: true,
},
]
},
{
name: 4,
questions: [
{
title: "Why not?",
name: "whyNotVisitDoctor",
visibleIf: "{visitedDoctor}=0",
type: "radiogroup",
choices: [
{
text: "I don't know of any health professionals who I believe could help.",
value: "noBelief"
},
{
text: "My pain hasn't gotten bad enough to justify getting examined.",
value: "notHurtEnough"
}
],
hasOther: true,
otherText: "Other (specify here)",
isRequired: true,
}
]
},
{
name: 5,
questions: [
{
title: "Which of the following areas of your life have MOST been harmed by your back pain?",
name: "worstImpact",
type: "checkbox",
choices: [
{
text: "Sleep",
value: "sleep"
},
{
text: "Sex",
value: "sex"
},
{
text: "Productivity / work / career",
value: "productivity"
},
{
text: "Social life",
value: "social"
},
{
text: "Play / sports / fitness / health",
value: "play"
}
],
hasOther: true,
otherText: "Other (specify here)",
isRequired: true,
}
]
},
{
name: 6,
questions: [
{
type: "html",
html: '<div class="alert alert-info">Okay, so, your back feels like a {backComfortRating}, and it has hurt for {duration}, and you\'ve mentioned that areas of your life have been significantly impacted by your back pain.</div>', //'<div class="alert alert-info">Okay, so, your back feels like a {backComfortRating}, you have been examined by a health professional, and you\'ve mentioned that areas of your life have been significantly impacted by your back pain.</div>'
name: "recap"
},
{
title: "I'm now curious: Which of the following traits describe you?",
name: "personality",
type: "checkbox",
choices: [
{
text: "Type A",
value: "typeA"
},
{
text: "Ambitious / Driven",
value: "ambitious"
},
{
text: "Particular / Has high standards",
value: "particular"
},
{
text: "Generous / Caring / Giving",
value: "generous"
},
{
text: "Responsible / Conscientious / Proper",
value: "responsible"
},
{
text: "(None of the above)",
value: "none"
}
],
isRequired: true,
}
]
},
{
name: 7,
questions: [
{
type: "html",
html: '<div class="alert alert-info">Okay, I see this pattern all the time. It\'s great news: your recovery time should be measured in days or weeks rather than months or years. <b>Where should I send your personalized back pain recovery plan?</b></div>',
name: "seeThisPattern"
},
{
title: "Email Address:",
placeholder: "john.smith@gmail.com",
name: "emailAddress",
type: "text",
isRequired: true,
},
{
title: "Your Name:",
placeholder: "John Smith",
name: "name",
type: "text",
isRequired: true,
},
/*{
title: "Want the book for free?",
name: "book",
type: "checkbox",
choices: [
"Yes, send me a free copy of your book when it's published!"
],
isRequired: false,
}*/
]
},
],
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
@sasankmukkamala Yes, it was the bug. I have fixed it.
PS: Please create the separate issue. It is easy to miss your bug report, because you have created it in the closed issue.
Thank you, Andrew
@andrewtelnov - I am facing a problem with this. When
showNavigationButtons: true
at survey level andnavigationButtonsVisibility: "hide"
at page level, it seems to be working as expected. ButshowNavigationButtons: false
andnavigationButtonsVisibility: "show"
are set, the buttons are not visible ever. If I am not wrong, according to the documentation this should work. Am I doing something wrong?