Tim, what are the guide lines in the new question creation interface?

Tim, what are the guide lines in the new question creation interface?

by Pierre Pichet -
Number of replies: 2

When a teacher create a new (i.e calculated) question he could do a lot of bad or at least incomplete things. The question text could be incomplete, the answer parameters (i.e the answer grade) could be badly defined. In some cases there is a feedback after clicking on the "save changes" button so that you could go back and correct the values, in other cases there is a javascript that check before change and in other cases default values ( ex question title) are added (silently) .

In the actual 1.8 code recoding, the javascript are used on a "voluntary" choice (i.e. check the formula in calculated question) but if you ignore this check, there is no checking when you "save changes".

What is the planning about using either javascript or php code to check the different fields to be filled when creating or editing questions in the new "standardized" interface?

Pierre

Average of ratings: -
In reply to Pierre Pichet

Re: Tim, what are the guide lines in the new question creation interface?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Everything must always be validated server-side in PHP before data is added to/changed in the database, and if it is not valid, then the form should be redisplayed, with appropriate error messages.

You may additionally do some bits of validation in JavaScript, to help the user to fix the problem before clicking submit, therefore saving them a little time, however this is a bonus, and not essential.

Note that Jamie Pratt is currently working on converting all the question editing forms to use the new forms library, ready for the 1.8 release. (I think he has mostly done it, and only has calculated question left, I told him to ask you, Pierre, if he needed any help understanding calculated question type.)
In reply to Tim Hunt

Re: Tim, what are the guide lines in the new question creation interface?

by Pierre Pichet -

Thanks for the precisions.

As the actual calculated creation process is actually a three step process, nothing is saved (just put in session data) until you complete the three step, it can be important to do javascript filtering mostly at the first form so that you don't loose your data.

Actually, if you write all you question text in the editor, you click "save changes", you realize at the second step that you have forgot a parameter so you get back to the first form using the back button of your browser, you loose all the text you put in the editor.

If you progress to the third step but do not complete by adding a data item,  ALL your work is lost...

This is related to the actual three step process creation code and to the necessity of a three step process because of the "wild card" parameter type that can be shared by questions in the same category.

See http://moodle.org/mod/forum/discuss.php?d=60929

From a discussion somewhere else, I understand that Martin wants to maintain all the actual possibilities of Moodle but that you are more in favor of a "rational cleaning" so that the code is more fullproof.

Given the short delays before the release of 1.8, I suggest that some javascript filtering be added following a proposal I had made

http://docs.moodle.org/en/Calculated_question_js_validating_forms

(the code should be evidently adapted to the new context...)

I will be happy to collaborate with Jamie.

When the rush will be over, we should decide which options should be maintained and developped for the calculated questions.