{"id":3106,"date":"2024-08-30T18:55:05","date_gmt":"2024-08-30T17:55:05","guid":{"rendered":"https:\/\/beams-experiments.com\/?page_id=3106"},"modified":"2024-09-14T09:38:28","modified_gmt":"2024-09-14T08:38:28","slug":"interim-task-questionnaire-h","status":"publish","type":"page","link":"https:\/\/beams-experiments.com\/index.php\/interim-task-questionnaire-h\/","title":{"rendered":"Interim-Task-Questionnaire-H"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \n    <style>\n        \/* Style definitions *\/\n        #progressBarContainer {\n            width: 90%;\n            background-color: #e0e0e0;\n            border-radius: 5px;\n            margin-top: 10px;\n        }\n\n        #progressBar {\n            height: 10px;\n            background-color: #007bff;\n            border-radius: 5px;\n            width: 0%;\n        }\n\n        #progressText {\n            text-align: center;\n            margin-top: 5px;\n        }\n\n        #nextButton {\n            display: block;\n            padding: 10px 20px;\n            background-color: #007bff;\n            color: white;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            margin: 10px auto;\n            width: fit-content;\n            position: relative;\n        }\n\n        #nextButton:disabled {\n            cursor: not-allowed;\n            opacity: 0.5;\n        }\n\n        .loadingSpinner {\n            border: 5px solid #f3f3f3;\n            border-top: 5px solid #3498db;\n            border-radius: 50%;\n            width: 60px;\n            height: 60px;\n            animation: spin 2s linear infinite;\n            position: fixed;\n            top: 50%;\n            left: 50%;\n            transform: translate(-50%, -50%);\n            z-index: 9999;\n            display: none; \/* Hidden by default *\/\n        }\n\n        @keyframes spin {\n            0% { transform: rotate(0deg); }\n            100% { transform: rotate(360deg); }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"loadingSpinner\" id=\"loadingSpinnerPage\"><\/div>\n\n    <form id=\"postTaskForm\">\n        <!-- Difficulty Question -->\n         <p><b>1. How difficult did you find this task? (where 1 represents &#8216;not at all&#8217; and 5 represents &#8216;the highest&#8217;)<\/b><\/p>\n        <label><input type=\"radio\" id=\"difficultyLevel\" name=\"difficultyLevel\" value=\"1\"> 1<\/label>\n        <label><input type=\"radio\" id=\"difficultyLevel\" name=\"difficultyLevel\" value=\"2\"> 2<\/label>\n        <label><input type=\"radio\" id=\"difficultyLevel\" name=\"difficultyLevel\" value=\"3\"> 3<\/label>\n        <label><input type=\"radio\" id=\"difficultyLevel\" name=\"difficultyLevel\" value=\"4\"> 4<\/label>\n        <label><input type=\"radio\" id=\"difficultyLevel\" name=\"difficultyLevel\" value=\"5\"> 5<\/label>\n\n \t<p><b>2. How do you rate your performance in this task? (where 1 represents &#8216;not good at all&#8217; and 5 represents &#8216;the highest&#8217;)<\/b><\/p>\n        <label><input type=\"radio\" id=\"selfTaskPerformance\" name=\"selfTaskPerformance\" value=\"1\"> 1<\/label>\n        <label><input type=\"radio\" id=\"selfTaskPerformance\" name=\"selfTaskPerformance\" value=\"2\"> 2<\/label>\n        <label><input type=\"radio\" id=\"selfTaskPerformance\" name=\"selfTaskPerformance\" value=\"3\"> 3<\/label>\n        <label><input type=\"radio\" id=\"selfTaskPerformance\" name=\"selfTaskPerformance\" value=\"4\"> 4<\/label>\n        <label><input type=\"radio\" id=\"selfTaskPerformance\" name=\"selfTaskPerformance\" value=\"5\"> 5<\/label>\n\n        <!-- Change in Confidence Question -->\n\n       <p><b>3.Compared to before starting this task, how has your belief in how well you can do a similar task changed?(-5 = Significantly decreased, 0 = No change, 5 = Significantly increased)<\/b><\/p>\n\t<div class=\"radio-container\">\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"-5\"> -5<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"-4\"> -4<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"-3\"> -3<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"-2\"> -2<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"-1\"> -1<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"0\"> 0<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"1\"> 1<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"2\"> 2<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"3\"> 3<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"4\"> 4<\/label>\n    <label><input type=\"radio\" id=\"postTaskEfficacyChange\" name=\"postTaskEfficacyChange\" value=\"5\"> 5<\/label>\n<\/div>\n\n        <!-- Reason for Change -->\n        <p><b>4. If there was a change, what do you believe was the primary reason for this change in your belief?<\/b><\/p>\n        <label><input type=\"radio\" name=\"reasonChangeTask\" value=\"1\" disabled> Understanding the task better<\/label>\n        <label><input type=\"radio\" name=\"reasonChangeTask\" value=\"2\" disabled> Enhanced belief in my abilities<\/label>\n\t<label><input type=\"radio\" name=\"reasonChangeTask\" value=\"3\" disabled> Decreased belief in my abilities<\/label>\n \t<label><input type=\"radio\" name=\"reasonChangeTask\" value=\"4\" disabled> Other reason<\/label>\n\n        <!-- Explanation of Other Reason -->\n        <p><b>5. If you selected &#8220;Other reason&#8221;, please describe it briefly:<\/b><\/p>\n        <textarea id=\"explanationChangeTask\" disabled><\/textarea>\n\n        <!-- Submit Button -->\n        <button type=\"button\" id=\"nextButton\" disabled>Next Task<\/button>\n    <\/form>\n\n    <!-- Progress Bar -->\n    <div id=\"progressBarContainer\">\n        <div id=\"progressBar\"><\/div>\n    <\/div>\n    <div id=\"progressText\">Page 1 out of 15<\/div>\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\"><\/script>\n<script>\n    $(document).ready(function() {\n        $('#loadingSpinnerPage').hide();\n        const nextButton = document.getElementById('nextButton');\n        const groupID = localStorage.getItem('groupID'); \/\/ Retrieve groupID from local storage\n\n        \/\/ Retrieve the task sequence and task numbers from localStorage\n        const taskSequence = JSON.parse(localStorage.getItem('taskSequence')) || [];\n        const taskSequenceNumbers = JSON.parse(localStorage.getItem('taskSequenceNumbers')) || [];\n\n        \/\/ Map task numbers to their URLs\n        const taskUrls = {\n            1: 'https:\/\/beams-experiments.com\/index.php\/tactical-decision-making-human\/',\n            2: 'https:\/\/beams-experiments.com\/index.php\/decision-making-strategic-human\/',\n            3: 'https:\/\/beams-experiments.com\/index.php\/evaluation-scoring-task-co-efficacy-human\/',\n            4: 'https:\/\/beams-experiments.com\/index.php\/risk-uncertainty-task-human\/',\n            5: 'https:\/\/beams-experiments.com\/index.php\/ethical-dilemma-task-human\/'\n        };\n\n        \/\/ Retrieve task index from URL parameters\n        const urlParams = new URLSearchParams(window.location.search);\n        let taskIndex = parseInt(urlParams.get('taskIndex')) || 0;\n        console.log('taskIndex is', taskIndex);\n\n        const totalPages = taskSequence.length + 10; \/\/ Adjust total pages according to tasks and any additional pages\n\n        \/\/ Function to update the progress bar and progress text\n        function updateProgressBar(taskIndex) {\n            const currentPage = taskIndex*2 + 6; \/\/ 4 (welcome+information+consent+pre-task quest)+ first task(still 0) + interim questionnare; *2 to account for each task and its interim questionnaire\n            const progressPercentage = (currentPage \/ totalPages) * 100;\n            document.getElementById('progressBar').style.width = `${progressPercentage}%`;\n            document.getElementById('progressText').innerText = `Page ${currentPage} out of ${totalPages}`;\n        }\n\n        \/\/ Initialize progress bar\n        updateProgressBar(taskIndex);\n\n        \/\/ Correct task type mapping\n        const taskTypeMapping = {\n            1: 'Tactical',\n            2: 'Strategic',\n            3: 'Idea',\n            4: 'Risk',\n            5: 'Ethical'\n        };\n\n        \/\/ Derive task type from taskSequenceNumbers using the current taskIndex\n        const taskType = taskTypeMapping[taskSequenceNumbers[taskIndex]];\n        console.log('taskType is', taskType);\n\n        \/\/ Define field names with correct task type\n        const difficultyName = 'difficultyLevel' + taskType;\n        const selfTaskPerformance = 'selfTaskPerformance' + taskType;\n        const postTaskEfficacyChange = 'postTaskEfficacyChange' + taskType;\n        const reasonChangeTask = 'reasonChange' + taskType;\n        const explanationChangeTask = 'explanationChange' + taskType;\n\n        \/\/ Set dynamic name attributes for radio buttons and text areas\n        $('input[type=\"radio\"]').each(function() {\n            if (this.id === 'difficultyLevel') {\n                this.name = difficultyName;\n            } else if (this.id === 'selfTaskPerformance') {\n                this.name = selfTaskPerformance;\n            } else if (this.id === 'postTaskEfficacyChange') {\n                this.name = postTaskEfficacyChange;\n            } else if (this.name === 'reasonChangeTask') {\n                this.name = reasonChangeTask;\n            }\n        });\n\n        $('#explanationChangeTask').attr('name', explanationChangeTask);\n        console.log('Setting explanationChangeTask name to:', explanationChangeTask);\n        \/\/ Store data in local storage without re-adding the task type\n        function storeDataInLocalStorage(key, value) {\n            \/\/ Check if the taskType is already appended to avoid double appending\n            if (!key.includes(taskType)) {\n                key += taskType; \/\/ Append the task type if it's not already there\n            }\n            localStorage.setItem(key, value); \/\/ Store data in localStorage with a task-specific key\n            console.log('Key & value are', key, value);\n        }\n\n        \/\/ Function to check if the form is complete\n        function checkFormCompletion() {\n            \/\/ Check if Questions 1 and 2 are answered\n            const firstQuestionAnswered = $('input[name=\"' + difficultyName + '\"]:checked').length > 0;\n            const secondQuestionAnswered = $('input[name=\"' + selfTaskPerformance + '\"]:checked').length > 0;\n\n            \/\/ Check if Question 3 is answered and its value\n            const thirdQuestionAnswered = $('input[name=\"' + postTaskEfficacyChange + '\"]:checked').length > 0;\n            const thirdQuestionValue = $('input[name=\"' + postTaskEfficacyChange + '\"]:checked').val();\n\n            \/\/ Check if Question 4 is answered and its value\n            const fourthQuestionAnswered = $('input[name=\"' + reasonChangeTask + '\"]:checked').length > 0;\n            const fourthQuestionValue = $('input[name=\"' + reasonChangeTask + '\"]:checked').val();\n\n            \/\/ Logic to enable\/disable fields and buttons\n            if (thirdQuestionAnswered && thirdQuestionValue === '0') {\n                \/\/ Disable Question 4 and 5 if Question 3 is '0'\n                $('input[name=\"' + reasonChangeTask + '\"]').prop('disabled', true).prop('checked', false);\n                $('#explanationChangeTask').prop('disabled', true).val('');\n                \/\/ Enable Next button if Questions 1, 2, and 3 are answered\n                nextButton.disabled = !(firstQuestionAnswered && secondQuestionAnswered && thirdQuestionAnswered);\n            } else if (thirdQuestionAnswered && thirdQuestionValue !== '0') {\n                \/\/ If Question 3 is not '0', check if Question 4 is answered\n                $('input[name=\"' + reasonChangeTask + '\"]').prop('disabled', false);\n                if (fourthQuestionAnswered && fourthQuestionValue === '4') {\n                    \/\/ If Question 4 is '4', enable and require Question 5\n                    $('#explanationChangeTask').prop('disabled', false);\n                    const explanationFilled = $('#explanationChangeTask').val().trim() !== '';\n                    nextButton.disabled = !explanationFilled;\n                } else {\n                    \/\/ Otherwise, disable Question 5 and just require Question 4\n                    $('#explanationChangeTask').prop('disabled', true).val('');\n                    nextButton.disabled = !fourthQuestionAnswered;\n                }\n            } else {\n                \/\/ If any of Questions 1-3 are not answered, disable the Next button\n                $('input[name=\"' + reasonChangeTask + '\"]').prop('disabled', true).prop('checked', false);\n                $('#explanationChangeTask').prop('disabled', true).val('');\n                nextButton.disabled = true;\n            }\n        }\n\n        \/\/ Event listeners for form inputs\n        $('input[type=\"radio\"]').change(function() {\n            storeDataInLocalStorage(this.name, this.value);\n            checkFormCompletion();\n        });\n\n        $('#explanationChangeTask').on('input', function() {\n            storeDataInLocalStorage(this.name, this.value);\n            checkFormCompletion();\n        });\n\n        \/\/ Go to next task\n        $('#nextButton').click(function() {\n            goToNextTask();\n        });\n\n        function goToNextTask() {\n            if (taskIndex < taskSequenceNumbers.length - 1) {\n                taskIndex++;\n                window.location.href = taskSequence[taskIndex] + '?taskIndex=' + taskIndex;\n            } else {\n                if (groupID == '0') {\n                    window.location.href = 'https:\/\/beams-experiments.com\/index.php\/post-tasks-questionnaire-co-efficacy-h';\n                } else if (groupID == '1') {\n                    window.location.href = 'https:\/\/beams-experiments.com\/index.php\/post-tasks-questionnaire-co-efficacy-HAI';\n                }\n            }\n        }\n    });\n<\/script>\n\n\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>1. How difficult did you find this task? (where 1 represents &#8216;not at all&#8217; and 5 represents &#8216;the highest&#8217;) 1 2 3 4 5 2. How do you rate your performance in this task? (where 1 represents &#8216;not good at all&#8217; and 5 represents &#8216;the highest&#8217;) 1 2 3 4 5 3.Compared to before starting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"footnotes":""},"class_list":["post-3106","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/3106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/comments?post=3106"}],"version-history":[{"count":83,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/3106\/revisions"}],"predecessor-version":[{"id":3611,"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/pages\/3106\/revisions\/3611"}],"wp:attachment":[{"href":"https:\/\/beams-experiments.com\/index.php\/wp-json\/wp\/v2\/media?parent=3106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}