Use JS to show and hide extra forms on bulk adding page#1817
Use JS to show and hide extra forms on bulk adding page#1817
Conversation
|
It seems like |
michaeljcollinsuk
left a comment
There was a problem hiding this comment.
When I tested locally, after adding the candidate details to the bulk add form and then submitted, only the last person that I entered was being passed through to the next step. Not entirely sure what was causing this bug but my guess was something JS related.
| {% include "bulk_add/sopns/_known-people.html" %} | ||
|
|
||
| <form method=POST id="bulk_add_form"> | ||
| <form method=POST id="bulk_add_form" data-winner-count="{{ ballot.winner_count }}"> |
There was a problem hiding this comment.
If winner_count is not set, this causes a 500 error
|
|
||
| // Remove empty fieldsets | ||
| var always_show_extra = $("form#bulk_add_form")[0].dataset['winnerCount'] * 3; | ||
| var always_show_extra = $("form#bulk_add_form")[0].dataset.winnerCount * 3; |
There was a problem hiding this comment.
I haven't had chance to check this out locally to test, but I dont think this would fix the 500 error I mentioned in an old comment that happens when a ballot does not have winner_count set? I think that will need a change in the view.
There was also another bug that I came across when testing originally, that from memory, was that if I filled in multiple candidates using the new "add a row" button, and then submitting the form, only the last candidate that I entered was being created/shown for review. But as mentioned it was a while ago I tested it locally so will need to go through again when I have chance!
64904b0 to
44bf9f8
Compare
Warning: I am BAD at JavaScript, so this might be a really bad way to do things.
Much manual testing required!