1=Strongly disagree
2=Disagree
3=Neither agree nor disagree
4=Agree
5=Strongly Agree
When submitted the questionnaire will sum the values (points) and then generate one of the 3 messages, first for a sum of points in a range from 0 to 10, second in a range from 11 to 20 and third in a range from 21 to 30.
Currently I am lost and not really sure how to do that, appreciating any help. Thank you in advance.
Petr
Sorry but I don't understand your form setup - is this six sets of radio buttons?
Basically you can use an Event Switcher in the On Submit event to sum the results and display the corresponding message.
Bob
I knew that the Event Switcher action is a potential option, however, I am not sure what exactly to put in the data provider and events to generate one of the three corresponding messages.
I am not an experienced programmer and thus I cannot solve this that easily.
Petr
[file=11391]questionnaire.png[/file]
Call your fields questions[#] replacing the # with either a number or unique name
Petr
if($total < 20) { return 1; }
else if($total < 40) { return 2; }
else if($total < 50) { return 3; }
0 syntax error, unexpected 'if' (T_IF)
even without showing the debug.
$total = array_sum($this->data($questions));
if($total >= 0 && $total <= 10) { return "1"; }
elseif ($total >= 11 && $total <=20) { return "2"; }
elseif ($total >= 21 && $total <=30) { return "3"; }
and it always keep returning var=1 even when the sum of values is for example 24.
Array
(
[option] => com_chronoforms6
[cont] => manager
[chronoform] => o3-questionnaire
[event] => submit
[questions] => Array
(
[1] => 4
[2] => 4
[3] => 4
[4] => 4
[5] => 4
[6] => 4
)
[button16] =>
)
Array
(
[data] => Array
(
[returned] => 1
[var] => 1
)
)
