Copied to clipboard

Flag this post as spam?

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


  • Martin 114 posts 313 karma points
    Nov 07, 2014 @ 15:26
    Martin
    0

    Can you use a partial view to insert a Contour form?

    Hi

    I have just started using Contour and the only way I found to insert and use a Contour form was to use an RTE field and choose insert the form macro. But surely there must be alternative method to insert och render Contour forms, aren'tthere?

    Regards,

    Martin

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 07, 2014 @ 15:49
    Dennis Aaen
    0

    HI Martin,

    When you have add Contour, then you can create a new data type under the data type folder, in the developer secton, and choose the form picker as the property editor. After that you can added it as a property to your document type, then you will get a list of forms, that can be choosen.

    Currently there is a problem, where you can't unselect a form when it as been selected on a page.

    Hope this helps,

    /Dennis

  • Martin 114 posts 313 karma points
    Nov 07, 2014 @ 15:53
    Martin
    0

    Thanks for the advice Dennis!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 07, 2014 @ 15:55
    Dennis Aaen
    0

    Hi Martin,

    I found the post, where I have seen the issue with the form picker http://our.umbraco.org/forum/umbraco-pro/contour/56349-Reset-form-picker-so-no-form-is-selected

    You can also reference a form directly into a template, but this is mean that is "hard coded" by the GUID of the form. It look like this  if you are using Umbraco 7 MVC:

    @Umbraco.RenderMacro("umbracoContour.RazorRenderForm", new {FormGuid="9c2b4732-c9ab-4ea6-9ff8-aa684851d59f"})

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 07, 2014 @ 16:10
    Dennis Aaen
    0

    Hi Martin,

    I have created an issue on this, you can find it here and vote for it: http://issues.umbraco.org/issue/CON-616

    /Dennis

  • Martin 114 posts 313 karma points
    Nov 07, 2014 @ 23:02
    Martin
    0

    I tried to use @Umbraco,RenderMacro but I got the error "Error loading MacroEngine script (file: MvcViewRenderContourForm.cshtml)", and looking in the log file, this was the output:

    2014-11-07 22:56:23,652 [14] WARN  umbraco.macro - [Thread 88] Error loading MacroEngine script (file: MvcViewRenderContourForm.cshtml, Type: ''. Exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at System.Web.WebPages.WebPageBase.CreateInstanceFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory)
       at umbraco.MacroEngines.RazorMacroEngine.CompileAndInstantiate(String virtualPath)
       at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
       at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
       at umbraco.macro.loadMacroScript(MacroModel macro)
       at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId).

    The same error also occurs when inserting the form macro in RTE, but I have no idea what is causing it. Perhaps you could point to any solution?

     

    Thanks in advance,

    Martin

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 07, 2014 @ 23:25
    Dennis Aaen
    0

    Hi Martin,

    How did you insert your form into your template, did you just copy my code above?

    Try go to a template in the settings section, choose a template and then click on the symbol for insert a macro, choose the insert form macro, and then you should get a list of your forms, that you could use. Choose a form and see if it goes better this time.

    Hope this helps,

    /Dennis

     

  • Martin 114 posts 313 karma points
    Nov 08, 2014 @ 07:56
    Martin
    0

    Hi again,

    Yes that is what I did (so the FormGuid is correct). I found in a different forum topic that "Object reference not set to an instance of an object" may be cause by an issue regarding capital letters, e.g. an Id is converted to id somewhere in the underlying code, and thus it is not recognized correctly. I am running Umbraco 7.1.8 and Contour 3.0.23.

    Regards,

    Martin

     

  • Martin 114 posts 313 karma points
    Nov 11, 2014 @ 09:33
    Martin
    0

    I now have solved it, it turned out that MvcViewRenderContourForm.cshtml was named incorrect, after changing to MvcRenderContourForm.cshtml it worked.

    Martin

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 11, 2014 @ 09:35
    Dennis Aaen
    0

    Hi Martin,

    That is great to hear that you solved it.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft