Forums

Scored form

xados.tom@gmail.com 12 May, 2019
Hi,

I would like to create a form with 11 questions, each question will have 3 answers which will give you points (for example 5-3-1) depending to the answer user will choose.
At the end will be a button which calculate all points and depending the total points will appear a new page with the total score and a text or a pic (will be 3 different pics depending total points) related to the score-points the users answer.
Is this possible to be created with chronoforms and how?

Thanks in advanced
healyhatman 12 May, 2019
Sure is. Easiest way is NAME each field question[0], question[1], etc etc. For the Value, use the value (your 5 3 or 1 for example). On submit, you can use the If Conditions to do different things depending on {data.sum:question}
xados.tom@gmail.com 13 May, 2019
Thanks your quick response.

I use drop down list instead of check boxes because i don't want multiple answers ( if it is possible to use check boxes without multiple answer for a question, please advice), i think that everything is ok, but i do not know how to create the if condition. i actually want when user hit score :
from 37-55 appear a text " Gold Metal" and a pic
from 20-36 appear a text " Silver Metal" and a pic
from 9-19 appear a text " Bronze Metal" and a pic
from 0-8 ς appear a text " Student" and a pic.

I also attach my form in order to help you understand.

Thanks again[file=12241]Quiz_13_May_2019_22_19_35.cf6bak[/file]
healyhatman 13 May, 2019
Use radio then instead of drop down.

Have you tried to do the if conditions?
xados.tom@gmail.com 14 May, 2019
Thanks for the idea using radio, i just did and it is ok.
Related with the Submittion and if condition, can you be more detailed about what to do, because i don't know where to put the if condition, where {data.sum:question} and where the texts and the pics to display.

I actually went to submit page actions section and i add a custom code just for an example with the above

<h2>Thank you for your question</h2>

<div class='cTitle'>
<h4>Hello </h4>


<?php
if ($form->data['{data.sum:question}'] >="37") {
?>
// HTML goes here1
<?php
}elseif ($form->data['{data.sum:question}'] >="20") {
?>
// HTML goes here2
<?php
}else{
?>
// HTML goes here3
<?php
}
?>

<br />

but it doesn't seem to working properly, when sum:question is 29 shows // HTML goes here3 instead of // HTML goes here2

what i am doing wrong?

Thanks again
healyhatman 15 May, 2019
You can't use shortcodes in PHP. Do this instead
$sum = array_sum($this->data("question"));
This topic is locked and no more replies can be posted.