Copied to clipboard

Flag this post as spam?

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


  • Tim Mather 38 posts 142 karma points
    Nov 09, 2017 @ 11:04
    Tim Mather
    0

    Error when displaying form on page.

    Hi,

    We are using Forms 6.0.3 and v1.8 of your package, when we attempt to render a form we get the following, any ideas, the file exists under the "default" theme folder but it seems it can't find it?

    enter image description here

    Any help appreciated! Great package so far, does exactly what we need if we can get it to display.

    Thanks

    Tim

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Nov 09, 2017 @ 15:19
    Daniël Knippers
    100

    Hi Tim,

    After testing a bit it seems this exception seems to be raised when rendering an Umbraco Form using code like this:

    Html.RenderAction("Render", "UmbracoForms", new { formId = g });
    

    It appears this is the "old" render action that was used before Forms added theme support. This action will look in the Views/Partials/Forms/Fieldtypes folder for the fieldtype .cshtml files.

    However, ever since supporting themes, the "new" way to render forms seems to be a slightly different action:

    Html.RenderAction("RenderForm", "UmbracoForms", new { formId = formId })
    

    That is, you should call the "RenderForm" action rather than the "Form" action. I took this from the Macro Partial "InsertUmbracoFormWithTheme.cshtml".

    Can you check that it works if you change this RenderAction call? And otherwise, you can simply copy our FieldTypes to the /Views/Partials/Forms/Fieldtypes folder, that should work as well.

    Regards, Daniël

  • Tim Mather 38 posts 142 karma points
    Nov 09, 2017 @ 15:23
    Tim Mather
    0

    Hi, yes we actually managed to figure it out but thanks for the reply, it works with the new call. It also works if you just dump the partials for all the field types in the /views/partials/fieldtypes/ but guessing that ignores themes.

    On another note does the ability to pass a record guid via querystring still allow you to populate the fields? Believe it may have been removed from forms as part of a security update but would be handy for us?

    Thanks

    Tim

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Nov 09, 2017 @ 15:28
    Daniël Knippers
    0

    Hey Tim,

    Good to hear you had already solved the issue. I don't know anything about populating fields using the record id in the querystring, I guess you'll have to just test it and see if it still works :-) It is not something we would add with our package though, so if it has been removed you'll have to find another way. Good luck!

    ~ Daniël

  • Paul 18 posts 159 karma points
    Dec 29, 2017 @ 11:38
    Paul
    0

    Hi folks, I think my issue is related to this.

    I've just manually upgraded Umbraco Forms to 6.0.5 (and I'm using Umbraco version 7.6.5 assembly: 1.0.6428.37121)

    When using the 'Insert Form with theme' macro, i'm able to pick the form and theme.

    But I receive this error message:

    Error loading Partial View script (file: ~/Views/MacroPartials/InsertUmbracoFormWithTheme.cshtml)
    

    I've checked my log file and can see this message:

    2017-12-29 11:23:14,999 [P4780/D5/T65] WARN  umbraco.macro - Error loading Partial View (file: ~/Views/MacroPartials/InsertUmbracoFormWithTheme.cshtml). Exception: System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. ---> System.InvalidOperationException: The partial view '/Views/Partials/Forms/Themes/default/FieldTypes/FieldType.Perplex Text field.cshtml' was not found or no view engine supports the searched locations. The following locations were searched:/Views/Partials/Forms/Themes/default/FieldTypes/FieldType.Perplex Text field.cshtml
    

    I edited the filename of /Views/Partials/Forms/Themes/default/FieldTypes/FieldType.PerplexTextField.cshtml

    to read 'FieldType.Perplex Text field.cshtml'

    And the form shows fine. This seems like an odd way to fix the issue though.

    Does anyone know why this file is being called like this? Where can I change it to request 'FieldType.PerplexTextField.cshtml' instead of 'FieldType.Perplex Text field.cshtml'

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Dec 29, 2017 @ 12:01
    Daniël Knippers
    1

    Hi Paul,

    Are you using the latest version of our package? It assume you might have a version < 1.7, as at some point I added a line to our Field Types which explicitly states the view name. Otherwise, it would use the "friendly name" to find the view, in this case "Perplex Text field".

    For example, in PerplexTextField.cs, I added this:

    FieldTypeViewName = $"FieldType.{nameof(PerplexTextField)}.cshtml";
    

    That would result in "FieldType.PerplexTextField.cshtml". So upgrading our package would probably resolve your issue.

    ~ Daniël

  • Paul 18 posts 159 karma points
    Dec 29, 2017 @ 13:52
    Paul
    0

    Daniël, thanks so much. You're right I only have version 1.6.

    Rookie questions, but what's the best way to upgrade? Can I simply remove and reinstall the package without affecting my built forms?

    I don't have access to nuget right now unfortunately, if that was going to be the best answer.

    Kind regards, Paul

  • Daniël Knippers 153 posts 1116 karma points MVP 2x c-trib
    Dec 29, 2017 @ 14:06
    Daniël Knippers
    0

    Hi Paul,

    You should be able to simply update from within Umbraco (Developer > Packages > search for ours), or download the ZIP and choose "Install local". If you created any folders in the Forms section, make sure to backup App_Plugins/PerplexUmbracoForms/data/folders.json and put it back after. The forms themselves are stored by Umbraco, we do not touch them. Of course, test this first in a test environment :-)

  • Paul 18 posts 159 karma points
    Dec 29, 2017 @ 16:01
    Paul
    0

    Thanks so much Daniel, that worked :)

    All the very best, Paul

Please Sign in or register to post replies

Write your reply to:

Draft