Open anst-i opened 2 months ago
In my opinion, the best option would be to make a new variant of the input field. Then we could also introduce new options like the text of the add button or the dynamic label in front of the new fields.
My second-best suggestion would be to control it via an extra option and give the add button a generic look (plus symbol?).
Thank you for the input! @sangwinc showed me a code prototype of a dynamic code block for looping over more general things including answer inputs, and it was looking great.
In the meantime, I fixed two bugs in the above javascript code: It created one field too few, and the update_back function hat an undefined
.
Yes, I do have some design ideas which need more discussion. We approach week 1 of semester, so this will have to wait for a couple of weeks!
We've used this concept a handful of times at UC. Our original solution involved having a large number of hidden boxes that students could reveal by clicking a button, but we drastically simplified that this year by just using the Text area input type along with a custom validation function:
validate_form(ex):= block( every( lambda([ex2],ntuplep(ex2) or listp(ex2)) ,ex) );
That way they can give us many ordered pairs as they need to in a reasonably well-formatted way.
Sometimes a teacher does not want to give away how many solutions there are to some question, like the zeroes of a polynomial, describing a set through a number of equations, giving a basis for a vector space, etc. In this case, teachers can ask students to provide their answers as a list
[a1, a2, ..., an]
, but this is not the natural way how we would give such an answer on paper. Also, it is harder for students to review if what they entered is what they wanted to enter. Giving the option to add more input fields is an elegant solution, and it does make the student think more about the structure of their answer.Here are two sample screenshots and working javascript code:
This code was originally written by @m-r-k, and I've adapted it for our Moodle where we can't use
<
and>
inside<script>
tags. There are several shortcomings to this right now: Having several such questions on one page breaks the code due to non-uniqueid
s, and it's a bit cumbersome to modify it since you really have to understand the code. The first thing can be solved using[[quid]]
s, but this isn't available on our installation yet, so I didn't do it. Wrapping up the second thing in the general interface is a bit more complicated, but it would be very nice to have it.I haven't properly thought through the implementation options yet. Is this a new dynamic question block, or is it a modification of the
[[input]]
syntax, or a matter of configuring the input? Comments on this are very welcome.