Silverlight for Umbraco Media Objects is a Silverlight 4 application for managing, editing and uploading images to the media section of an Umbraco installation and is a collaboration between Microsoft Uk and some umbraco community members.
Umbraco’s formbuilder Contour is great for adding forms to your website! It doesn’t stop at contact forms and questionnaires, in this post I’ll show you how you can add a poll to your site using Contour.
Step 1: Setting up the form
Using Contour’s slick interface it’s super easy to create the form, simply navigate to the Contour section (if Contour is installed, otherwise first install it from the package repo) and create a new form.
On that new form setup a new field of the type ‘radiobutton list’ and we’ll make this a mandatory field since you’ll have to select an option before you can submit your vote.
Once the field is added you can simply setup the different options
Once the options are setup simply save the form and you should end with something like this:
Step 2: Displaying the results
Ok now we have a form that will capture the votes. Next we need a way of displaying the results. Contour has some default xslt extensions you can use to fetch the submitted records.
But what I need to do is to first fetch all the different options, for that I’ll just create a custom xslt extensions that just returns some xml that has an overview of all questions and answers on a form
foreach (PreValue pv in fld.PreValueSource.Type.GetPreValues(fld))
XmlNode answer = d.CreateElement("answer");
XmlAttribute answerId = d.CreateAttribute("id");
answerId.Value = pv.Id.ToString();
XmlCDataSection value = d.CreateCDataSection(pv.Value);
Then we’ll write some xslt that will use this extensions to output a list of questions with their different options. We also need to know how many records have been submitted and how many ‘votes’ each answers has. To see the total number of submitted records for a form we can use the default contour xslt extension umbraco.contour:GetRecordsFromForm(‘form id’) , the total number of votes(records) we can get by counting the records count(umbraco.contour:GetRecordsFromForm(‘form id’)/uformrecord) then the only think left is to count the number of votes each option has…
The end result of the xslt that will output the results:
Registration just opened for the second round of official umbraco courses, this time held in Ghent, Belgium.
Level 1 is running on 30 November - 1 December and level 2 on 2-3 December.
These are the same courses taught throughout the world and will teach you everything you need to know to attain your Umbraco Certification (including new umbraco 4.5 functionality, the new xml schema,Linq 2 umbraco, Examine,…).