Text: Unaided Awareness - Each Item Disabled Until Previous Entered
This article will help you program am Unaided Awareness question with each item disabled until the previous one has been entered
Unaided Awareness Question
You can setup an Unaided Awareness question with multiple parts and have the boxes disabled for the next box until the previous one has been used. This allows you to have data entered in consecutive boxes.
Instructions
- Add a 'Text Fields' question type to your survey with all of the appropriate responses
- See article: Standard Question: Text Fields
- Add the code below to your '+ Javascript'.
- See article: Adding JavaScript and/or CSS to a Question
jQuery('.cm-text-response-set').each(function() { var jInputs = jQuery(this).find('.cm-text-input-container input[type="text"]'); jInputs.prop('disabled', true); jInputs.first().prop('disabled', false); var jRows = jQuery(this).find('.cm-response-container'); jRows.css("display", "none"); jRows.slice(0, 20).css("display", "block"); jInputs.on('change keyup paste', function(event) { var target = event.currentTarget; var jTarget = jQuery(target); var value = jTarget.val(); if (value.trim() != "") { var index = jInputs.index(target); if (jInputs.length > index) { jQuery(jRows[index + 1]).css("display", "block"); jQuery(jInputs[index + 1]).prop('disabled', false); } } }); });
- See article: Adding JavaScript and/or CSS to a Question
- Add the code below to '+ CSS'.
- See article: Adding JavaScript and/or CSS to a Question
/* FORMAT DISABLED ITEMS */ .cm-text-response-set input[type="text"]:disabled { background-color: #ECECEC; }
- See article: Adding JavaScript and/or CSS to a Question
- Make sure to test