Nibble

New Package - Poll package for umbraco 4

I finally got round to polish and package the umbraco poll I made some time ago. So here it is …

image

The package installs the following:

image

 

The document types (Polls, Poll, Poll Answer) will be used to setup the polls.

image

So you’ll have a Polls document that will contain several Poll documents and these will have several Poll Answer documents beneath it.

After you have setup a poll with some answers in your content area you can get the poll on your page.

First add a reference to the installed stylesheet (/css/Nibble.Umb.Poll.css) and then place the Poll macro on your template.

Please note that:

  • The macro will have to be placed inside a form with runat=”server” attribute
  • There has to be a scriptmanager on the page

The poll macro has several parameters:

image

 

  • Poll Node Id: This is the id of the Poll content node that you want to display
  • Display Only: Check this if you only want to display the results of a poll
  • Submit On Select: Check this if you want to submit the vote when a user selects a answer
  • Hide Submit: Check this if you want to hide the submit button
  • Sort Results: Check this if you want that the results are sorted by number of votes
  • Width Total Votes: Instead of the highest number of votes being equal to 100% width, the total number of votes is 100%
  • Hide Question: Check this if you want to hide the question
  • Random Poll: Check this if you want to display a random Poll, you’ll also have to update the Poll Node Id to the Polls document (containing the different polls)

 

So depending on the parameters (Submit On Select and  Hide Submit) your poll can look like:

image

or (with submit button)

image

The Results can look like this:

image

Sorted:

image

Width Total Votes:

image

You can download the package here: http://our.umbraco.org/projects/poll

18 Comments so far

  1. Petr Snobelt on July 7th, 2009

    Another very nice package, thanks

    Petr

  2. Don on January 29th, 2010

    Hi Petr, very nice package! Can you please help me to make the pollNodeId dynamic? Because this is using a .NET control, Umbraco won’t let me call the poll from an xslt file using RenderMacroContent() function. I can set the poll ID at a page level, but if I want to use the same poll on many pages, such as a blog, blog post, etc… then I would have to select the poll at each page, which is a pain! Please help!

    Thanks!

  3. Patrick Rietveld on March 18th, 2010

    Hi Petr, nice package. I’m new to umbraco but have a lot of experience with DotNetNuke and Sitefinity. With Sitefinity it’s possible to create a custom property editor. For instance an editor to select a poll from a list. Could you let me know if this is possible with Umbraco? If so, i’m willing to contribute to this module.

  4. sIMON on May 21st, 2010

    Hi, is there a way to display a ImageButton instead of Button for the form? Also, is it possible to have a link to show the result without voting?

    Thank you

  5. new2umbraco on May 30th, 2010

    Hi there, I am new to Umbraco and I need to install this package on a website. Can someone please help me with the starting steps?
    Thank you in advance

  6. new2umbraco on May 30th, 2010

    I cannot get it to work :(.
    I am stuck at
    Please note that:

    * The macro will have to be placed inside a form with runat=”server” attribute
    * There has to be a scriptmanager on the page

    Can someone help please?

    Thank you

  7. andrew on July 30th, 2010

    hi,
    the database script for “tblPoll” seems to be missing from your package install? are you able to email it to me?
    thanks a lot,
    andrew

  8. Craig on December 14th, 2010

    Hello,

    I have installed Umbraco Poll and got it working on the homepage of http://11-19.firstmedia-cms.co.uk but when I hit the Submit button on the Poll, I get the following error:-

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MAAU; InfoPath.2; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C; .NET4.0E)
    Timestamp: Tue, 14 Dec 2010 15:46:21 UTC

    Message: Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is not valid.
    Line: 5
    Char: 84093
    Code: 0
    URI: http://11-19.firstmedia-cms.co.uk/ScriptResource.axd?d=aYvNRD7Fify51xL44_N1UBmisO03m0P7zpZ9bU9b8j8VehoPYeeRPAKZ_drsuq4qxmlX2×2Ab5dhTHgtSeuBoEonwP8_E9iqTWJ1oWGANsCriRHVbjTOl9ALPXt_fWFrb7INZTrfgBbrqaaXtoPft5xK_bI7chwZqTaY28aZvas1&t=2610f696

    Message: Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is not valid.
    Line: 5
    Char: 84093
    Code: 0
    URI: http://11-19.firstmedia-cms.co.uk/ScriptResource.axd?d=aYvNRD7Fify51xL44_N1UBmisO03m0P7zpZ9bU9b8j8VehoPYeeRPAKZ_drsuq4qxmlX2×2Ab5dhTHgtSeuBoEonwP8_E9iqTWJ1oWGANsCriRHVbjTOl9ALPXt_fWFrb7INZTrfgBbrqaaXtoPft5xK_bI7chwZqTaY28aZvas1&t=2610f696

    It is a Javascript error on the page.

    What have I setup wrong?

    Thanks.
    Regards,
    Craig.

  9. Brian Meyers on June 29th, 2011

    Craig,

    I am getting the exact error message as you reported. Did you happen to get a resolution to the problem?

    thanks,
    Brian

  10. Brendan on August 17th, 2011

    I am also having the same issue as “Craig on December 14th, 2010″ and “Brian Meyers on June 29th, 2011″.

    When the poll is submitted I get the following error:

    Error: Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is not valid.
    Source File: http://umbraco.dnsalias.com/ScriptResource.axd?d=WtcquFfZ5vs2GXyg7fv1E7ARMwRj7I1NdaA2LiH_G6QR6w3V82C5J00pt1DK5DPD3LOrRG5ZjpA23ZDetyDXKRyGvLP9cbkHWgf6_JJhKDz5_GTEB6lunVrpmkJTZRjXmlQEC4QGYukDCYItkRsToVwBU3vSq7RLwFBeqvPIKd4fzG-goWzspq4FhTWoBpMi0&t=2610f696
    Line: 5

    Has anyone found out why this happens and how to fix it?

    Many thanks, Brendan

  11. Brendan on August 17th, 2011

    I’ve found the answer to :

    Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is not valid.

    Simply set the votes for your poll answers to a number.

    I found this by taking out the update panels and you see that there’s actually a server error in casting within the SelectAwnser() method.

    If you are able to submit the source code I could have a look at fixing it for you.

    I suspect its within this part:

    if (document.getProperty(”votes”).get_Value() != DBNull.Value)
    {
    num = (int) document.getProperty(”votes”).get_Value();
    }

  12. dimitris chrysomallis on September 12th, 2011

    The download link is broken.

    Please update the URL.

  13. Zoltan on January 30th, 2012
  14. Diana Marcela on February 14th, 2012

    I cannot get it to work.

    Please note that:

    * The macro will have to be placed inside a form with runat=”server” attribute
    * There has to be a scriptmanager on the page

    Can someone help please???

  15. Moran on December 26th, 2012

    Where can I download the source code? I tried to download it from the project site in umbraco but I get an error.

  16. Sailen on January 23rd, 2013

    Solution for:
    Sys.WebForms.PageRequestManagerServerErrorException: Specified cast is not valid.

    Add this additional condition (answerDoc.getProperty(”votes”).Value.ToString() != “”), you have to do similar like this on couple of steps. line 161, 224 & 247

    Eg:
    On page Poll.ascx.cs line 161
    if (answerDoc.getProperty(”votes”).Value != DBNull.Value && answerDoc.getProperty(”votes”).Value.ToString() != “”)
    {
    currentvotes = (int)answerDoc.getProperty(”votes”).Value;
    }

    Also package missed database script to create table tblPoll, you can add it manually :)

  17. Robin on February 21st, 2013

    Nice package. Where did you find the documentation of how to work with databases in Umbraco? I searched for it but couldn’t find it. Any help is appreciated!

  18. Chintan on October 29th, 2014

    Hi,

    I tried your Poll Plugin with Umbraco 6.1 but I cant install package completely and at the end of the installation, it gives object not set to an instance of the object error.

    Install packge do not create document types you shown in this article and so I cant use the poll.

    Can you guide if there is any way to install this poll plugin in umbraco 6 successfully ?

    Thanks in advance.

    Chintan Dave.

Leave a Reply