32

Once you have cast your three votes, can you cancel one of them?

I know you can re-cast a vote for another candidate, but what if you'd like to withdraw one of your three votes because you are not confident about the others?

4 Answers 4

36

You can't cancel a vote directly, but you can do it indirectly by changing the position of a candidate you have already voted for to get the same result.

For example, assume that the candidate you do not want to vote for anymore is your current 3rd choice.

  1. From your 3 candidates, re-cast your vote for your 2nd choice and make him/her your 3rd choice.
  2. The act of doing so will replace your 3rd choice and move your 2nd choice to the 3rd choice position, and leave you with an empty 2nd choice
  3. You can then go back and re-cast your vote for your current 3rd choice (former 2nd choice) to move them back to the 2nd choice.

You now have 2 votes cast, one for your 1st choice, one for your 2nd choice, and no 3rd vote. You can choose to reuse it later if you so desire, or leave it empty.

Since you need to have at least 1 candidate to move into a slot in order to cancel another, you cannot cancel all of your votes. If you need to cancel all of your votes, then you can use the hack that timaschew discovered and/or support Braiam's feature request asking for this functionality to be explicitly added.

5
  • Accepting because the first three words answer the question. Too bad cancellation is not an option. I wonder if this was an intentional site functional design.
    – keithmaxx
    Commented Apr 20, 2015 at 8:35
  • @keithmaxx might just be an oversight, or could be that the workaround is simple enough. You'd have to ask that question to get that answer probably from an SE dev or community manager. Commented Apr 20, 2015 at 10:06
  • But it's impossible to cancel all of my votes, right?
    – nwellnhof
    Commented Apr 21, 2015 at 6:05
  • @nwellnhof correct, because you need at least 1 candidate to move into a slot in order to cancel another. Commented Apr 21, 2015 at 7:39
  • @nwellnhof it's possible with a hack, see my answer
    – timaschew
    Commented Nov 21, 2015 at 19:24
15

Like psubsee2003 explained you can withdraw one of your votes.

If you want to withdraw all your votes you can do it this way:

  1. Open the developer toolbar of your browser and go to the network tab
  2. Just set any choice to a random user
  3. Find the XHR item in the network tab and use the context menu (right mouse click) and choose Copy as cURL (I'm using chrome, not sure where to find this in another browser)
  4. Paste the clipboard into a terminal
  5. At the end you should see something like &voteIndex=1'. Just set the number to 0 and press Enter

You should get this answer:

{"Success":false,"Message":"Invalid vote cast","NewScore":0}

Now go back to your browser and refresh the page ;)

3
  • Very good find. Commented Nov 21, 2015 at 19:23
  • The title says votes, plural. I refactored the answer. Of course my answer is explaining more than how to cancel one vote, but cancel all 3 votes is absolutely related to this question even if there are users who asking this in the comments.
    – timaschew
    Commented Nov 21, 2015 at 19:44
  • 2
    This is the "application as a library" design style proving itself. Nice find. Commented Nov 23, 2015 at 1:06
4

I created the following userscript. It adds a link next to each vote. Clicking the link deletes the vote.

// This is where votes are displayed
var $votePicks = $(document.getElementById('vote-picks'));

// This link will be displayed next to each vote and will allow to delete it
var $deleteLink = $('<span> <a title="Delete vote">✘</a></span>').click(function() {
  document
    .querySelector('.candidate-row[data-candidate-id = "' + $(this).closest('div').data('candidate-id') + '"]')
    .querySelector('.candidate-vote-button[data-index = "0"]')
    .click();
});

// Rearrange elements in $votePicks and add deletion links
function addDeleteLinks() {
  $votePicks.children('div').each(function() {
    var $this = $(this);
    $this.attr('data-candidate-id', ($this.find('a').prop('href').match(/\/(\d+)\//) || [])[1]);
    $this.prevUntil('div').prependTo(this);
    $this.next().appendTo(this);
    $this.find('.label-key').append($deleteLink.clone(true));
  });
}

// Hijack $.fn.html in order to call addDeleteLinks after $votePicks is overwritten.
var html = $.fn.html;
$.fn.html = function (value) {
  var ret = html.apply(this, arguments);
  if(value === void 0 || this.length !== 1 || this[0] !== $votePicks[0]) return ret;
  addDeleteLinks();
};

// Also call addDeleteLinks at the beginning
addDeleteLinks();

// Add a hidden button next to each candidate. Clicking it will delete the vote for that candidate
$(document.querySelector('.candidate-vote-button')).clone(true).attr('data-index', 0).hide().val('Cancel vote').prependTo('.candidate-vote-buttons');

// Hijack showInfoMessage in order to detect successful deletion votes
var showInfoMessage = $.fn.showInfoMessage;
$.fn.showInfoMessage = function(msg) {
  if(msg !== "Invalid vote cast" || this.length !== 1 || !this.hasClass('post-text')) return showInfoMessage.apply(this, arguments);
  var $tr = this.closest('tr');
  $votePicks.find('[data-candidate-id = "' + $tr.data('candidate-id') + '"]').remove();
  $tr.find('.candidate-vote-button').removeClass('selected-choice not-selected-choice');
};
1
-5

Supposing you vote X as 1st Choice, Y as 2nd Choice and Z as 3rd Choice and later you realize that R would be a better second choice, all you need to do is go to R's post and click the 2nd Choice button.

It will automatically replace Y.

But once a vote is cast, there's no reversal.

8
  • Not what the OP asked for. He wants to cancel a vote entirely not change a vote. Commented Apr 20, 2015 at 8:19
  • Read it now. Made the changes. :) Commented Apr 20, 2015 at 8:20
  • It is still not what was asked for. The OP explicitly said "I know you can re-cast a vote for another candidate", which is exactly what you are explaining how to do. Commented Apr 20, 2015 at 8:21
  • Please read the last line Commented Apr 20, 2015 at 8:22
  • 1
    I see the last line. Commented Apr 20, 2015 at 8:23
  • So it's fine yes? Because there's no method to take back a vote once it's cast. No? Commented Apr 20, 2015 at 8:24
  • 1
    Are you sure about that? Commented Apr 20, 2015 at 8:24
  • Yup. Checked it out a couple of times myself. So made changes instead to the votes I cast. Commented Apr 20, 2015 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .