Copied to clipboard

Flag this post as spam?

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


  • Craig100 1078 posts 2366 karma points c-trib
    Feb 10, 2015 @ 19:28
    Craig100
    0

    How to use own partial to output form

    The uHangout video alluded to being able to define your own Form.cshtml so you can get better control of the form's layout and styles.  The video didn't say how in detail and it's not in the docs.

    I want to add a very simple newsletter sign up box, single field, but all in line with some text in a particular section of a site's footer. The existing layout makes a mess of it so I want to build my own partial that fits in.

    However, the original Form.cshtml will be fine for the two other forms on the site so I don't want to mess with that. I want to be able to define which view is to be used for which form.

    How do we go about that?

    Thnx

    Craig

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Feb 10, 2015 @ 20:23
    Dennis Aaen
    0

    Hi Craig,

    Could it be this that you are looking for. http://youtu.be/iTKb4k4UJqU?t=18m10s Per shows how you can set the Forms, to use your own view.

    Hope this helps,

    /Dennis

  • Craig100 1078 posts 2366 karma points c-trib
    Feb 10, 2015 @ 23:02
    Craig100
    0

    Thanks Dennis,

    That's the video I mentioned that only gives you half the details. I sorted the other half out now:-

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @if (Model.MacroParameters["FormGuid"] != null)
    {
        var s = Model.MacroParameters["FormGuid"].ToString();
        var g = new Guid(s);
        var v = Model.MacroParameters["View"].ToString();
    
        Html.RenderAction("Render", "UmbracoForms", new {formId = g, mode = "form", view = v});
    }

    Which works once you add a macro parameter called "View" with a type of textbox.

    Next problem is can we add new Fieldtypes?  I need to add placeholder text into a text box so have copied Fieldtypes/FieldType.Text.cshtml but don't know where to register the new one so it becomes a choice in the Form creation grids.  There will be another question after that, as I'll need a way of adding the text that is translatable. Dictionary item or some such ;)

    Craig

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Feb 10, 2015 @ 23:07
    Dennis Aaen
    0

    Hi Craig,

    For how to add a new fileld types, I think that you should have a look on this documentation https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Extending/Adding-a-Fieldtype and https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Extending/Adding-a-Type

    Hope this helps,

    /Dennis

  • Craig100 1078 posts 2366 karma points c-trib
    Feb 11, 2015 @ 13:44
    Craig100
    0

    Refs:
    https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Custom-Markup
    https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Extending/Adding-a-Fieldtype
    https://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Extending/Adding-a-Type ;

    Looking into what has to be done to add a View, then add a FieldType, with all the additional trial and error required, I'm thinking this is far too complicated and time consuming just to get an email address captured in a simple, single input form, embedded in a site footer. I'll just use normal MVC for this.

    Cheers,

    Craig

  • Craig100 1078 posts 2366 karma points c-trib
    Feb 11, 2015 @ 13:59
    Craig100
    0

    Hi Dennis,

    Sorry, I didn't see your post before I posted mine (don't know why). Thanks for your help.

    Craig :)

  • 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