Commit 32596ffa by Will Daly

Enable/disable submit button for self-assessment

parent cf61b2a9
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div class="self-assessment__actions"> <div class="self-assessment__actions">
<ul class="list list--actions"> <ul class="list list--actions">
<li class="list--actions__item"> <li class="list--actions__item">
<button type="submit" id="self-assessment--001__assessment__submit" class="action action--submit"> <button type="submit" id="self-assessment--001__assessment__submit" class="action action--submit is--disabled">
<span class="copy">{% trans "Submit Your Assessment" %}</span> <span class="copy">{% trans "Submit Your Assessment" %}</span>
<i class="ico icon-caret-right"></i> <i class="ico icon-caret-right"></i>
</button> </button>
......
...@@ -151,6 +151,17 @@ OpenAssessment.BaseUI.prototype = { ...@@ -151,6 +151,17 @@ OpenAssessment.BaseUI.prototype = {
function(html) { function(html) {
$('#openassessment__self-assessment', ui.element).replaceWith(html); $('#openassessment__self-assessment', ui.element).replaceWith(html);
// Install a change handler for rubric options to enable/disable the submit button
$("#self-assessment--001__assessment", ui.element).change(
function() {
var numChecked = $('input[type=radio]:checked', this).length;
var numAvailable = $('.field--radio.assessment__rubric__question', this).length;
$("#self-assessment--001__assessment__submit", ui.element).toggleClass(
'is--disabled', numChecked != numAvailable
);
}
);
// Install a click handler for the submit button // Install a click handler for the submit button
$('#self-assessment--001__assessment__submit', ui.element).click( $('#self-assessment--001__assessment__submit', ui.element).click(
function(eventObject) { function(eventObject) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment