Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • praveity 100 posts 125 karma points
    May 09, 2012 @ 05:32
    praveity
    0

    How to get answer of the Caption with especial characters

    Hi to all, 

    I have an Umbraco Contour form with the question with multiple options for an answer, the problem is as follows:

    I could set the caption with especial characters such as semicolon, quote and rest on the contour form designer. It is also shown perfectly on the page as well. But after the record is set on submission of the form I am trying to make analysis based on the answer selected.

    On the razor script I did the following, 

    one of the question is "Ik zie internet voor kinderen vooral als...", it contains the extra dots,, similar other contains the colon, semicolon, qoute and double quote. This line gives me error with "no sequence elements" although there is selection made by the user.

    How can we make these especial charactors work out as well.

    var f = Contour.Addons.DynamicObjects.Library.GetRecordsFromForm("formID").Items.Where(n => n.Id.ToString() == recordid);
    const string q1 = "Ik zie internet voor kinderen vooral als...";
    
    @foreach (dynamic rec in f)
    {
        // attitude questionaires :: START //
        try
        {
            var answer = @rec.GetField(q1).Values[0];
            if (answer == "answer_text1") { positive++; }
            else if (answer == "answer_text2")
            { negative++; }
        }
        catch (Exception) { }
    }
Please Sign in or register to post replies

Write your reply to:

Draft