Skip to content

Commit

Permalink
prevent adding question with no answers
Browse files Browse the repository at this point in the history
  • Loading branch information
benadida committed May 27, 2017
1 parent 166c783 commit 0609dcb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions helios/templates/election_questions.html
Expand Up @@ -49,13 +49,19 @@ <h3 class="title">{{election.name}} &mdash; Questions <span style="font-size:0.7
new_q.answer_urls[i-1] = form['answer_url_' +i].value;
}

return new_q;
if (new_q.answers.length == 0) {
return null;
}

return new_q;
}

function question_add(form) {
var new_q = get_question_from_form(form);
QUESTIONS.push(new_q);
save_questions(refresh);
if (new_q) {
QUESTIONS.push(new_q);
save_questions(refresh);
}
}

function question_remove(q_num) {
Expand Down

0 comments on commit 0609dcb

Please sign in to comment.