Skip to content

Commit

Permalink
Merge pull request #34 from Hackathon2020/bugfix-radio-buttons
Browse files Browse the repository at this point in the history
Radio-Buttons shoult now read properly
  • Loading branch information
cwecht committed Mar 22, 2020
2 parents cb6c881 + 19da63d commit ca55857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions project/flaskr/static/js/data_processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function read_options(question_id, class_name) {
var answers = [];
for (var i = 0; i < answer_elements.length; i++) {
if (answer_elements[i].checked) {
answers.push(answer_elements[i].id.split("_")[1]);
answers.push(answer_elements[i].id.split("_")[2]);
}
}
return answers;
Expand Down Expand Up @@ -101,7 +101,7 @@ function form_to_answer(questionaire) {
answer = read_checkbox_answer(question_id);
break;
case "RadioButtons":
answer = read_checkbox_answer(question_id);
answer = read_radio_answer(question_id);
break;
default:
console.warn("Parsing answers: answer type " + question.answer_type + " not known!");
Expand Down
4 changes: 2 additions & 2 deletions project/flaskr/templates/questionnair/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
{% elif question.anwser_type == 'RadioButtons' %}
{% for option in question.options_texts %}
{% set inner_loop_index = loop.index0 %}
{% set answer_id_inner = 'answer_' + question.question_id | string + question.options[inner_loop_index] | string%}
{% set answer_id_inner = 'answer_' + question.question_id + '_' | string + question.options[inner_loop_index] | string%}
<label class="questionnair">
<div class="title">{{option}}</div>
<input id={{answer_id_inner}} type="radio" name="customRadio">
<input id={{answer_id_inner}} type="radio" name="customRadio" class="radio">
<span class="checkmark"></span>
</label>
{% endfor %}
Expand Down

0 comments on commit ca55857

Please sign in to comment.