I’m creating a filtering quiz and I’ve got most of the code worked out (except for field validation- I gave up on that), but it’s not working properly. Someone who knows Wix forms really well, I’d really appreciate your help!
Here’s a link to the quiz: https://www.beckettarnolddesigns.com/free-quiz
So the problems are as follows:
-
None of the answers are being recorded. They’re all laid out on the submission table, but only the answer to the very first question records.
-
When a user finishes the quiz, they’re supposed to be directed to the end state, but the end state only flashes for a second, and then they’re redirected to the first question.
Here’s my code:
var selectedValue
//----------------------FUNNEL QUIZ FORM Sate 1----------------------//
export function q1submit_click(event) {
// if ($w('#orgYorN').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
selectedValue = $w('#orgYorN').selectedIndex
if(selectedValue ===0)
{$w('#funnelQuiz01').changeState("q2")}
if(selectedValue ===1)
{$w('#funnelQuiz01').changeState("sorry")}
}
//----------------------FUNNEL QUIZ FORM State 2----------------------//
export function q2submit_click(event) {
// if ($w('#radioGroup1').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
$w('#funnelQuiz01').changeState("q3")
}
export function q2back_click(event) {
$w('#funnelQuiz01').changeState("q1")
}
//----------------------FUNNEL QUIZ FORM State 3----------------------//
export function q3submit_click(event) {
// if ($w('#selectionTags1').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please select at least 1 option"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
$w('#funnelQuiz01').changeState("q4")
}
export function q3back_click(event) {
$w('#funnelQuiz01').changeState("q2")
}
//----------------------FUNNEL QUIZ FORM Sate 4----------------------//
export function q4submit_click(event) {
// if ($w('#clientsYorN').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
selectedValue = $w('#clientsYorN').selectedIndex
if(selectedValue ===0)
{$w('#funnelQuiz01').changeState("q5clients")}
if(selectedValue ===1)
{$w('#funnelQuiz01').changeState("q5revenue")}
}
export function q4back_click(event) {
$w('#funnelQuiz01').changeState("q3")
}
//----------------------FUNNEL QUIZ FORM Sate 5----------------------//
export function q5revSubmit_click(event) {
// if ($w('#slider3').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please select an amount to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
$w('#funnelQuiz01').changeState("q6revenue")
}
export function q5revBack_click(event) {
$w('#funnelQuiz01').changeState("q4")
}
export function q5cliSubmit_click(event) {
// if ($w('#slider2').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please select an amount to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
$w('#funnelQuiz01').changeState("q6clients")
}
export function q5cliBack_click(event) {
$w('#funnelQuiz01').changeState("q4")
}
//----------------------FUNNEL QUIZ FORM Sate 6----------------------//
export function q6revSubmit_click(event) {
// if ($w('#moreRevYorN').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
selectedValue = $w('#moreRevYorN').selectedIndex
if(selectedValue ===0)
{$w('#funnelQuiz01').changeState("q7")}
if(selectedValue ===1)
{$w('#funnelQuiz01').changeState("looksGood")}
}
export function q6revBack_click(event) {
$w('#funnelQuiz01').changeState("q5revenue")
}
export function q6cliSubmit_click(event) {
// if ($w('#moreClientsYorN').selectedValue === null) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
selectedValue = $w('#moreClientsYorN').selectedIndex
if(selectedValue ===0)
{$w('#funnelQuiz01').changeState("q7")}
if(selectedValue ===1)
{$w('#funnelQuiz01').changeState("looksGood")}
}
export function q6cliBack_click(event) {
$w('#funnelQuiz01').changeState("q5clients")
}
//----------------------FUNNEL QUIZ FORM Sate 7----------------------//
export function q7submit_click(event) {
// if ($w('#slider4').selectedValue === false) {
// $w('#q1submit').disable()
// $w('#errorText').show()
// $w('#errorText').text = "Please make a selection to continue"
// setTimeout (function () {
// $w('#q1submit').enable()
// $w('#errorText').hide()
// },2000)}
// else
selectedValue = $w('#bounceRate').selectedIndex
if(selectedValue ===4)
{$w('#funnelQuiz01').changeState("looksGood")}
else
$w('#funnelQuiz01').changeState("q8")
// if ($w('#slider4').value > 3){
// $w('#funnelQuiz01').changeState("q8");}
// if ($w('#slider4').value < 3){
// $w('#funnelQuiz01').changeState("sorry");}
}
export function q7back_click(event) {
$w('#funnelQuiz01').changeState("q6")
}
//----------------------FUNNEL QUIZ FORM Sate 8----------------------//
export function q8submit_click(event) {
$w('#funnelQuiz01').changeState("q9")
}
//----------------------FUNNEL QUIZ FORM Sate 9----------------------//
export function q9submit_click(event) {
$w('#funnelQuiz01').changeState("q10")
}
export function q9back_click(event) {
$w('#funnelQuiz01').changeState("q8")
}
//----------------------FUNNEL QUIZ FORM Sate 10----------------------//
export function q10submit_click(event) {
$w('#funnelQuiz01').changeState("q11")
}
//----------------------FUNNEL QUIZ FORM Sate 11----------------------//
export function q11submit_click(event) {
$w('#funnelQuiz01').changeState("endState")
}
//END OF QUIZ CODE//
Any help will be greatly appreciated, thanks in advance!