Page 1 of 1

extra field ?

Posted: Wed Oct 03, 2007 1:47 pm
by antisa
Is is possible to display a text box if the result was true when the user has responded false ?

for example for the true/false quizz the response was false, the user would like to know why and what was the correct answer (some details)

Thanks for all!!

Posted: Fri Oct 05, 2007 12:20 pm
by battye
You asked that in your other post :)

Unfortunately, this isn't a feature.

Posted: Mon Dec 10, 2007 10:10 pm
by lennibert
Hi there, I could use some help on the same issue.
I really need comments to my questions, so it tried to fix it myself.

First I added a textfield to the quiz_multiple_choice_data table. For testing purposes I also added a few entries to the field.

I then added a column to the table in the quiz_result_body-template and invented a variable, which I called {answer_row.U_COMMENT}.

Now of course this variable needs to be defined, so I tried to do that in the quiz.php, but unfortunately I didn't get it to work. Any hints on what to add to quiz.php? Do more files have to be changed? For now I'm just interested in SEEING the comments, not editing them...

Posted: Tue Dec 11, 2007 7:23 am
by battye
1) You have to add a quiz_comment table into the respective database tables. From memory I think they are _true_false, _multiple_choice and _input_answer

It sounds like you have already done this part. If you didn't call it quiz_comment, then anywhere I've put quiz_comment below replace it with what you actually called it.

2) You can't just invent variables out of thin air. There will be a part of quiz.php where you will find:

Code: Select all

$template->assign_block_vars("answer_row", array(
FIND this. Below you might see something like

Code: Select all

"U_QUESTION" => $row['quiz_question']
Note: It might not be $row, it might be $quiz_row, or $question_row or something like that. This is important.

Below that, add U_COMMENT, ie:

Code: Select all

"U_COMMENT" => $row/$quiz_row/$question_row/etc['quiz_comment']
Now, don't include all of the slashes :wink:

If it is $row, you'd make it $row['quiz_comment'], if it was $quiz_row it would be $quiz_row['quiz_comment'] and so on.

In the .tpl file quiz_result_body.tpl, make sure if you are adding an extra column to the layout you increase whatever colspan value is included, otherwise the layout might look strange.

Good luck :)