I just run a board election for a private organization. All registered users (with a given role) have been entered as binary choices. Entering hundred usernames manually is a tedious and error prone process. Would be nice to have the option of entering usernames, by role(s), as binary choices. Thank you.

Comments

anders.fajerson’s picture

Version: 5.x-1.0-beta4 » 5.x-1.x-dev

This specific example is probably a too narrow case to be implemented. But maybe some kind of import functionality could be useful, e.g import binary choices from a CSV-file. In this case one would export usernames from the database or prepare it manually in Excel or similar and then import the file.

skizzo’s picture

I considered an uploadable "candidates list" too, but then I thought that Drupal might be used in many organizations where authenticated users are potentially both voters and candidates. If this scenario fits the majority of cases, then it would be better to load the candidates list from the user database, otherwise the generic candidates list upload would be required... In any case, one does not exclude the other... Thank you.

ChrisKennedy’s picture

I will agree with Anders that this will most likely be implemented in the foreseeable future as an import-choices-from-file or import-choices-from-textarea feature. They are more flexible features that will be used by a broader audience.

BUT once one or both of those are implemented it would be easy to copy and paste a list of users into the file/textarea.

anders.fajerson’s picture

Title: entering usernames (by roles) as binary choices » Import choices

Textarea sound like a good idea, maybe an option to swtich between a textarea and the usual choice fields as input option on the edit page.

anders.fajerson’s picture

Status: Active » Postponed
anders.fajerson’s picture

Status: Postponed » Active

One idea could be to switch to a textarea altogether, and store one choice per row. If it's possible to dynamically turn that HTML to an interface similar to what we have today we could gain two things: (i) a simple swith to an "import mode" and (ii) we could get rid of "#DANGEROUS_SKIP_CHECK" (not sure if it's a big problem though) and still have a responsive interface (not needing AJAX, see e.g. http://drupal.org/node/155870).

anders.fajerson’s picture

Status: Active » Needs review
StatusFileSize
new8.65 KB

Here is a start on the back-end. I think this looks promising.

* Choices is now a textarea instead of seperate input fields
* Maximus choices is now a texfield instead of a select since the user can add an unlimited amounts of choices directly.

This actually had more benefits than I thought from the beginning and a lot of (ugly) code was removed (#DANGEROUS_SKIP_CHECK, $form['#multistep'] , $_POST).

TODO:
* I haven't dealt with the write-ins on the edit page (see TODO in patch). Probably we could just store the information in a seperate array (?).
* No JavaScript yet, buy I'm positive here. Choices and max choices should ideally be converted to input fields resp. a select box on page load.

anders.fajerson’s picture

StatusFileSize
new8.88 KB

Fixed element names in form_set_error().

ChrisKennedy’s picture

I can see the appeal but I'm not convinced this is a good idea considering that importing choices is a low priority feature and could be implemented in a less obtrusive way.

1. It seems like a step backward in UI for non-JS users - instead of protected interface they have a free-form interface that is more error-prone.

2. Is it really going to simplify the code much if we have to re-implement the basic form items in javascript rather than using Drupal's Form API?

3. It's a dangerous data-integrity combination: it makes it intuitive to re-order the choices but makes it impossible to know whether or not the choices have been re-ordered so that the votes can stay consistent. And the AHAH features in D6 seems like it will make dynamic re-ordering of choices really simple to implement if we stick to our normal input boxes.

What do you think?

anders.fajerson’s picture

Status: Needs review » Needs work

1. True, but since everyone has JS these days, not such a big issue IMO.
2. I was thinking we render a "template" form item that we make available through Drupal.settings. It is sort of how we do it now, cloning an existing form item and replacing the numbers.
3. Not an issue UI wise if we assume that JS is used (which I think we should...) since the UI will look the same. It could be an issue if we want to support re-ordering of choices though, and this might be the big drawback. I can't immediately think of a good way of supporting this. But on the other hand we don't support that now either., and if we would, we probably have to introduce a 'weight' field... Hmm, we might need do elaborate more about the re-ordering thing.

The biggest advantage I see in this (now that you convinced me that the import thing is secondary) is that we have a way to provide new choices without having to resort to #DANGEROUS_SKIP_CHECK or AJAX. The new AHAH stuff I tested is cool, but the interface is not super snappy.

ChrisKennedy’s picture

IMO re-ordering of choices is inevitably going to need to be added at some point, because it's a fundamental necessity for a full-featured voting application. We shouldn't mandate that choices stay in the same order that they were originally submitted, forcing users to create a new poll if they want to revise the ordering. It will require a separate database field for choice_id and/or weight, and the ability to track that with the title & vote_offset of each choice. The UI can be implemented via both AJAX/AHAH and manual form submissions.

anders.fajerson’s picture

So I guess the "universal" textarea is of the list then. Too bad, it was a nice idea me thinks.

ChrisKennedy’s picture

Let's revisit this issue. We now have a "default choices" textarea for content-type settings, and we are close to having reordering support. I bet it will be pretty easy to just add an "import choices" fieldset with a textarea in it.

ChrisKennedy’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Needs work » Active

I've been thinking about this old issue a little bit. What if when you first create a poll you have a textarea, then when editing it uses the usual input choices? That would make it easier to create polls with a lot of choices while still allowing us to track choice ids *after* a poll has been created. Or would this be confusing to the user?

anders.fajerson’s picture

Sounds like a good trade-off limiting the import option to new polls. Shouldn't be confusing if the UI is done right.

gobinathm’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

D6 is EOL, hence this won't be fixed / attended.