diff --git a/physics/templates/physics/partials/exam_take_fragment.html b/physics/templates/physics/partials/exam_take_fragment.html
index f0d36e4e..7487cb46 100644
--- a/physics/templates/physics/partials/exam_take_fragment.html
+++ b/physics/templates/physics/partials/exam_take_fragment.html
@@ -60,7 +60,13 @@
{% endif %}
{% if next %}
-
+
+
+
+
+
{% else %}
{% if not exam.publish_results %}
@@ -128,6 +134,58 @@
document.getElementById('goto-button').value = e.currentTarget.dataset.qn;
$('#goto-button').click();
});
+
+ // Skip confirmation: if the user's current selections differ from
+ // the saved answer, prompt before allowing the HTMX skip to proceed.
+ (function(){
+ const skip = document.getElementById('skip-button');
+ if(!skip) return;
+
+ // Build a JS array of saved answers (booleans) or null
+ {% if saved_answer %}
+ const savedAnswers = [{% for s in saved_answer %}{{ s|yesno:"true,false" }}{% if not forloop.last %}, {% endif %}{% endfor %}];
+ {% else %}
+ const savedAnswers = null;
+ {% endif %}
+
+ function readCurrent(){
+ const lis = document.querySelectorAll('ol.physics-answer-list li');
+ return Array.from(lis).map(li => {
+ const inp = li.querySelector('input');
+ return !!(inp && inp.checked);
+ });
+ }
+
+ skip.addEventListener('click', function(evt){
+ try{
+ const current = readCurrent();
+ let changed = false;
+ if(savedAnswers === null){
+ // no previously-saved answer; any current selection is a change
+ changed = current.some(Boolean);
+ } else {
+ if(current.length === savedAnswers.length){
+ for(let i=0;i