Copied to clipboard

Flag this post as spam?

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


  • Rodrigo 27 posts 100 karma points
    Oct 07, 2015 @ 10:26
    Rodrigo
    0

    Umbraco forms conditions with umbraco 7.3

    Hi All, I'm testing umbraco forms on 7.3. The conditions in umbraco forms aren´t working in frontend in 7.3. I done all the steps to put forms working. I also tested in 7.2.8 and is working.

    I'm getting an error on console: "Uncaught SyntaxError: Unexpected end of input". Even if don´t have conditions i get this error.

    The hidden field is not displayed when i choose an option.

  • Gleb Kaplan 49 posts 125 karma points
    Oct 16, 2015 @ 13:43
    Gleb Kaplan
    106

    It seems indeed a bug in Forms under 7.3

    The workaround I found is to replace one line in Views/Partials/Forms/Script.cshtml

    <input type="hidden" id="values_@Model.FormClientId" value="@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Pages.SelectMany(p => p.Fieldsets).SelectMany(fs => fs.Containers).SelectMany(c => c.Fields).ToDictionary(f => f.Id, f => f.Value)))" />

    with

    <input type="hidden" id="values_@Model.FormClientId" value='@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Pages.SelectMany(p => p.Fieldsets).SelectMany(fs => fs.Containers).SelectMany(c => c.Fields).ToDictionary(f => f.Id, f => f.Value)))' />

    The difference is using apostrophes instead of quotes for value attribute.

  • Rodrigo 27 posts 100 karma points
    Oct 23, 2015 @ 13:21
    Rodrigo
    0

    Thanks a lot Gleb,

    Works with that change.

  • James Jackson-South 489 posts 1747 karma points c-trib
    Sep 08, 2016 @ 01:35
    James Jackson-South
    0

    Please be aware that this is still an issue even with the change if an apostrophe is used in a field value. I have submitted a ticket suggesting possible fixes.

    http://issues.umbraco.org/issue/CON-1163

    Cheers

    James

  • Zac 223 posts 575 karma points
    Nov 26, 2015 @ 17:47
    Zac
    0

    Still an issue in Umbraco Forms 4.1.4 on Umbraco 7.3.2

    Gleb's workaround works:

    <input type="hidden" id="values_@Model.FormClientId" value="@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Pages.SelectMany(p => p.Fieldsets).SelectMany(fs => fs.Containers).SelectMany(c => c.Fields).ToDictionary(f => f.Id, f => f.Value)))" />
    <!-- Replace the above line in Views/Partials/Forms/Script.cshtml with the following: -->
    <input type="hidden" id="values_@Model.FormClientId" value='@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Pages.SelectMany(p => p.Fieldsets).SelectMany(fs => fs.Containers).SelectMany(c => c.Fields).ToDictionary(f => f.Id, f => f.Value)))' />
    
  • Celeste Sampaga 1 post 71 karma points
    May 25, 2016 @ 16:24
    Celeste Sampaga
    0

    Thank you Gleb!!! This change certainly worked for me! Conditions now working as expected :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies