Copied to clipboard

Flag this post as spam?

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


  • Michael B 17 posts 97 karma points
    Dec 08, 2023 @ 18:20
    Michael B
    0

    Umbraco Forms Not Loading

    This issue is in Umbraco 10.8

    I can create Forms in the Forms tab with no issue.

    I then go into a General Content grid page, and add a Form section to the grid. Inside the Form macro section, I can select the form I am trying to add (which means it can recognize the form exists somewhat).

    However, after this step is when I encounter problems. Firstly, the Form macro block never loads a rendering of the form enter image description here

    So I can add the form (meaning the Form tab in the content grid sees the form exists), but it doesn't render the form's structure. This is behavior not replicated in the previous version of the website or in other demos. The form structure should load a sort of preview structure in this box. But it gets worse.

    When I save and Publish it as is, I render it in the code using the following line:

    @await Umbraco.RenderMacroAsync("renderUmbracoForm", new {FormGuid = form, FormTheme = theme, ExcludeScripts = "0" });
    

    Now at this point a couple things happen when I include the above method. If I try to reload the content page on the backend, the MacroParameters["FormGuid"] will return a guid, but the page will repeatedly loop trying to find the form to populate the async method (which it never does) causing Visual Studio to crash with a stack overflow exception. After this, the backend content grids do not work properly unless I comment out that line of code even after the app has been restarted.

    Now if I try to load the page itself, the form just doesn't exist, and the MacroParameters["FormGuid"] value will return an empty string, meaning now it cannot find anything.

    I am baffled, as Umbraco can locate the form on the backend enough to select it as the form I want, but after this trying to load the form either crashes the website or returns a blank guid causing it to not load anything. Has anyone had this happen before, or have any ideas how to get the forms to populate properly? Appreciate any help you can provide.

  • Jane Carol 22 posts 92 karma points
    Feb 26, 2024 @ 08:44
    Jane Carol
    0

    Did you find any solution for this?

  • Michael B 17 posts 97 karma points
    Feb 26, 2024 @ 13:48
    Michael B
    0

    Admittedly I do not really know why it was happening, but I was able to get it working.

    What worked for me was removing the InsertUmbracoFormWithTheme.cshtml file that I had in my project. This is a migration from Umbraco 7 so there were a lot of files that are deprecated. I removed the file, and the project was then able to render forms properly.

    Even though the syntax was updated to seemingly work properly, it wasn't, and I believe what was going on is Umbraco moved the logic into a dll, but the physical form existing in the project was acting as an override and routing the workflow into the broken logic there. By removing the file it allowed it to go into the proper process and render the form. But that is only my suspicion.

  • Jane Carol 22 posts 92 karma points
    Feb 26, 2024 @ 14:27
    Jane Carol
    0

    Yes removing the file helped to render the form. Thanks

    But when i remove a form and add the same form in richtextbox while saving it shows

    Microsoft.Data.SqlClient.SqlException, Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5: Cannot insert duplicate key row in object 'dbo.umbracoRelation' with unique index 'IXumbracoRelationparentChildType'. The duplicate key value is (3353, 7489, 6). The statement has been terminated.

  • Michael B 17 posts 97 karma points
    Feb 26, 2024 @ 17:37
    Michael B
    0

    That error I did not encounter, sorry.

Please Sign in or register to post replies

Write your reply to:

Draft