1 M.core_question_engine = M.core_question_engine || {};
4 * Initialise a form that contains questions printed using print_question.
5 * This has the effect of:
6 * 1. Turning off browser autocomlete.
7 * 2. Stopping enter from submitting the form (or toggling the next flag) unless
8 * keyboard focus is on the submit button or the flag.
9 * 3. Removes any '.questionflagsavebutton's, since we have JavaScript to toggle
10 * the flags using Ajax.
11 * @param Y the Yahoo object. Needs to have the DOM and Event modules loaded.
12 * @param form something that can be passed to Y.one, to find the form element.
14 M.core_question_engine.init_form = function(Y, form) {
15 Y.one(form).setAttribute('autocomplete', 'off');
16 Y.on('key', function (e) {
17 if (!e.target.test('a') && !e.target.test('input[type=submit]') &&
18 !e.target.test('input[type=img]') && !e.target.test('textarea')) {
22 Y.one(form).all('.questionflagsavebutton').remove();