11 lines
945 B
JavaScript
11 lines
945 B
JavaScript
define("mod_survey/validation",["exports","core/str","core/notification"],(function(_exports,_str,_notification){var obj;
|
|
/**
|
|
* Javascript to handle survey validation.
|
|
*
|
|
* @module mod_survey/validation
|
|
* @copyright 2017 Dan Poltawski <dan@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
* @since 3.3
|
|
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.ensureRadiosChosen=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};_exports.ensureRadiosChosen=formid=>{const form=document.getElementById(formid);form.addEventListener("submit",(e=>{0!==form.querySelectorAll('input[type="radio"][data-survey-default="true"]:checked').length&&(_notification.default.alert((0,_str.get_string)("error"),(0,_str.get_string)("questionsnotanswered","survey"),(0,_str.get_string)("ok")),e.preventDefault())}))}}));
|
|
|
|
//# sourceMappingURL=validation.min.js.map
|