diff --git a/plugins/jspsych-survey-likert.js b/plugins/jspsych-survey-likert.js index e3c356be..59bbcafa 100644 --- a/plugins/jspsych-survey-likert.js +++ b/plugins/jspsych-survey-likert.js @@ -38,6 +38,7 @@ jsPsych.plugins['survey-likert'] = (function() { // default parameters for the trial trial.preamble = typeof trial.preamble === 'undefined' ? "" : trial.preamble; trial.required = typeof trial.required === 'undefined' ? false : trial.required; + trial.button_label = typeof trial.button_label === 'undefined' ? 'Submit Answers' : trial.button_label; // if any trial variables are functions // this evaluates the function and replaces @@ -80,7 +81,7 @@ jsPsych.plugins['survey-likert'] = (function() { } // add submit button - form_element.innerHTML += ''; + form_element.innerHTML += ''; form_element.addEventListener('submit', function(e){ e.preventDefault(); diff --git a/plugins/jspsych-survey-text.js b/plugins/jspsych-survey-text.js index ac473abc..f452520f 100644 --- a/plugins/jspsych-survey-text.js +++ b/plugins/jspsych-survey-text.js @@ -50,6 +50,8 @@ jsPsych.plugins['survey-text'] = (function() { plugin.trial = function(display_element, trial) { trial.preamble = typeof trial.preamble == 'undefined' ? "" : trial.preamble; + trial.button_label = typeof trial.button_label === 'undefined' ? 'Submit Answers' : trial.button_label; + if (typeof trial.rows == 'undefined') { trial.rows = []; for (var i = 0; i < trial.questions.length; i++) { @@ -62,6 +64,12 @@ jsPsych.plugins['survey-text'] = (function() { trial.columns.push(40); } } + if (typeof trial.values == 'undefined') { + trial.values = []; + for (var i = 0; i < trial.questions.length; i++) { + trial.values.push(""); + } + } // if any trial variables are functions // this evaluates the function and replaces @@ -75,12 +83,12 @@ jsPsych.plugins['survey-text'] = (function() { for (var i = 0; i < trial.questions.length; i++) { display_element.innerHTML += '
'+ '

' + trial.questions[i] + '

'+ - ''+ + ''+ '
'; } // add submit button - display_element.innerHTML += ''; + display_element.innerHTML += ''; display_element.querySelector('#jspsych-survey-text-next').addEventListener('click', function() { // measure response time