Formatted answers in Calculated Multichoice Questions

Formatted answers in Calculated Multichoice Questions

by Martin Latschenberger -
Number of replies: 8

Hello,

I want to use Calculated Multichoice Questions within a quiz.  So far so good - I have understood the funcionality, etc.
BUT: as I can see, the choices / answers cannot be formulated by use of Atto / TinyMCE but only as a simple text field, where no formatting or complex answers are possible.

Is this really a missing functionality or just matter of settings I did not discover so far?

Looking forward to your answers. 

Thx, Martin

PS: I am trying with version 3.8.2+

Average of ratings: -
In reply to Martin Latschenberger

Re: Formatted answers in Calculated Multichoice Questions

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Martin,

Is this really a missing functionality or just matter of settings I did not discover so far?
I think this is a missing functionality.

You can try the Formulas question, with which you can get, for example:


See MoodleFormulas.org.

or


See MoodleFormulas.org.

In reply to Dominique Bauer

Re: Formatted answers in Calculated Multichoice Questions

by Martin Latschenberger -
Hi Dominique,
thank you for your reply. I have already discovered the Formulas qtype.
What I am missing there is a function for number formatting (comma separator, thousands separator, decimal places).
And constructing complex answers is also very hard (by combining the answers by using the join-function). Is there any easier way for this?
Thx, Martin
In reply to Martin Latschenberger

Re: Formatted answers in Calculated Multichoice Questions

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Martin,

What I am missing there is a function for number formatting...
There is a sigfig() function for significant digits, but there is no specific built-in function for the comma separator, the thousands separator and the decimal places. You have to work with the available functions and maybe some javascript. Have fun! smile

And constructing complex answers is also very hard (by combining the answers by using the join-function). Is there any easier way for this?
At the moment, I don't see any other way to do it.

In my previous post, the correct link is Multi choice with TeX equations.

In reply to Dominique Bauer

Re: Formatted answers in Calculated Multichoice Questions

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I would like to add that the choices in a multiple choice question of the Formulas question can easily be formatted, and that links and elements such as images, videos and audios can easily be inserted:


Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Formatted answers in Calculated Multichoice Questions

by Martin Latschenberger -

Hi Dominique,

thank you for the supplement. In the meantime I am preparing my complex choices (including formatted tables) outside of Moodle by using the text functions of Excel and then copying/pasting the final choice to Moodle. 

Example: 
b = join("","<table><tr><td style=width:248px>",text_21,"</td><td>",currency,"</td><td style=width:56px;text-align:right>",value_21,"</td></tr><tr><td style=width:248px>",text_22,"</td><td>",currency,"</td><td style=width:56px;text-align:right>",value_22,"</td></tr><tr><td style=width:248px>",text_23,"</td><td>",currency,"</td><td style=width:56px;text-align:right>",value_23,"</td></tr></table>");

It's laborious but it's working. 

An integrated editor for elaborating such choices would be very helpful 😉
And also a function for formatting dates, values, etc to local settings (comma separator, thousand separator, etc) would be great. 😉

Regards, Martin

In reply to Martin Latschenberger

Re: Formatted answers in Calculated Multichoice Questions

by Martin Latschenberger -
Hi Dominique,

how can I join quotes into the resulting string? I haven't found a solution until now.
What is the correct syntax for this?

Thank you
Martin
In reply to Martin Latschenberger

Re: Formatted answers in Calculated Multichoice Questions

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Martin,

I see in you previous post: <td style=width:248px>. This is the correct syntax and it will work, while <td style="width:248px"> or <td style='width:248px'> will not work.

By the way, you may be interested to know that quotes in attributes such as style or href are not strictly required in HTML (not XHTML), in other words, attribute values ​​can be unquoted.


If you want to include quotes for other reasons, you cannot put regular single quotes or double quotes, but you can put other types of quotes such as ‘ ’ ‛ ‟ “ ” „ « » ❝ ❞ ", etc. See for example &what;.

In reply to Dominique Bauer

Re: Formatted answers in Calculated Multichoice Questions

by Martin Latschenberger -
Hello Dominique,
I have found another way for formatting the numbers in my preferred standard format (with 2 decimals, comma as comma seperator and point as thousand separator): I have created a new function similar to "str(number)" and named it "amt(number)" - amt is for amount, has a numerical input and returns this input not just as string as is, but as formatted string.
At the moment this seems to be the best way for me ...