-
Notifications
You must be signed in to change notification settings - Fork 27
Use JS to show and hide extra forms on bulk adding page #1817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
It seems like |
michaeljcollinsuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!