Copied to clipboard

Flag this post as spam?

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


  • Sven 34 posts 138 karma points
    Jun 16, 2021 @ 09:14
    Sven
    0

    Umbraco Forms conditional logic not working

    Hello!

    We're using latest version of umbraco forms v8.7.3 with a umbraco v8.8.4.

    Our master template has a simple setup using the @Html.RenderUmbracoFormDependencies() in the <head>.

    We're rendering our form using: @Umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = Model.Form, FormTheme = "custom-form", ExcludeScripts = "1" })

    Our custom form is a copy of the default theme with some extra css changes. No changes have been done on javascript or any classes needed for conditional logic.

    Important notice: we're using vue as components for some pages. It's not a vue application but vue is linked above the main tag with id="app".

    <body>
    <div id="app">
                @Html.Partial("Header", Model)
    
            <main id="main">
                    @Html.Partial("Breadcrumbs", Model)
                    @RenderBody()
            </main>
    
                @Html.Partial("Footer", Model)
        </div>
    </body>
    

    Using any script tags in the main tag results in vue warnings such as: Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.

    I'm using a simple form to test this with the following setup: enter image description here

    Results: enter image description here

    Any idea what we're doing wrong? Thanks!

  • Lili 5 posts 96 karma points c-trib
    Jul 09, 2021 @ 08:17
    Lili
    0

    Hi, I'm experiencing the same issue, wondering if you had any updates on this.

  • Owain Jones 65 posts 437 karma points MVP 4x c-trib
    Aug 06, 2021 @ 15:13
    Owain Jones
    0

    Hi Sven, did you ever get this to work?

    We're seeing the same thing on Forms v8.7.5 with Umbraco v8.15.0

  • Jamie Townsend 62 posts 287 karma points c-trib
    Aug 14, 2021 @ 18:02
    Jamie Townsend
    0

    Same here - not working

  • Sören Deger 733 posts 2844 karma points c-trib
    Sep 12, 2021 @ 14:34
    Sören Deger
    0

    Same here - Umbraco 8.16.0 and Forms 8.7.6

  • Laurence Gillian 600 posts 1219 karma points
    Aug 26, 2022 @ 11:07
    Laurence Gillian
    0

    Did any one figure this out?

  • horsted 74 posts 136 karma points
    Nov 04, 2022 @ 07:51
    horsted
    1

    You need to include (not exclude) scripts, like...

    @Umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = Model.Form, FormTheme = "custom-form", ExcludeScripts = "0" })
    
  • Thomas 319 posts 606 karma points c-trib
    Feb 02, 2023 @ 12:43
    Thomas
    0

    Having the same issue in Umbraco 10 ? Did you find out what was wrong ?

  • Nick 14 posts 98 karma points c-trib
    May 12, 2023 @ 12:12
    Nick
    1

    Using umbracoforms 8.13.8 For those still having this problem in umbraco 8: It seems that the problem is caused by the init function of the umbracoforms.js. In the console i got the error [object Object] is not valid JSON. The cause is that the init function expects the object with with the form and a boolean indicating if the passed form is parsed to an object or if it is still a JSON string. This error caused the rest of the script to stop rendering. Which in turn prevents the code for the conditional rendering to stop working. I fixed it by adding the following check in the umbracoforms.js script starting on line 71:

    function init(e, jsonParsed) {
      if(jsonParsed === undefined){
        jsonParsed = e.form.constructor != "".constructor;
      }
      else{
        jsonParsed = jsonParsed && e.form.constructor != "".constructor;
      }
    // rest of the standard init function
    }
    

    The script is found in App_Plugins/UmbracoForms/Assets/Themes/Default/

  • 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