Copied to clipboard

Flag this post as spam?

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


  • Gonzalo 1 post 71 karma points
    Mar 07, 2016 @ 18:51
    Gonzalo
    0

    Issue when inserting macro into RTE in grid system.

    Hello,

    I'm new here although I enter in the forum almost every day to resolve doubts.

    But there is one thing I can´t find.

    I have a simple partial view macro:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{Html.RenderPartial("ContactForm", new Models.ContactFormModel { CssClass = @Model.MacroParameters["CssClass"].ToString() });}
    

    And a partial view:

    @model Models.ContactFormModel
    
    @{
        var formSent = false;
        var success = TempData["Success"];
        var contactErrorMessage = TempData["ContactErrorMessage"];
        if (success != null)
        {
            bool.TryParse(success.ToString(), out formSent);
        }
    }
    
    <a id="contact" name="contact"></a>
    <div class="contact-form-slim @Html.Raw(Model.CssClass)">
        <div style="text-align:left;">
            @if (formSent)
            {            
                <h2>Thank you for contacting us.</h2>
                <p>Your message has been successfully sent. We will contact you very soon.</p>    
            }
            else
            {
                if (contactErrorMessage != null && !string.IsNullOrEmpty(contactErrorMessage.ToString()))
                {            
                <p class="error">
                    @contactErrorMessage.ToString()
                </p>
                }
                <h2 style="color: black;">Contact us</h2>
                using (Html.BeginUmbracoForm<Controllers.ContactFormSurfaceController>("SubmitForm", new { action = Request.Url }, FormMethod.Post))
                {           
                <div class="contact-form-slim-item">
                    @Html.LabelFor(model => model.Name)
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
                <div class="contact-form-slim-item">
                    @Html.LabelFor(model => model.Email)
                    @Html.EditorFor(model => model.Email)
                    @Html.ValidationMessageFor(model => model.Email)
                </div>
                <div class="contact-form-slim-item">
                    @Html.LabelFor(model => model.Phone)
                    @Html.EditorFor(model => model.Phone)
                    @Html.ValidationMessageFor(model => model.Phone)
                </div>
                <div class="contact-form-slim-item-comments">
                    @Html.LabelFor(model => model.Comments)
                    @Html.TextAreaFor(model => model.Comments, new { rows = "3", cols = "20", @class = "mceNoEditor" })
                </div>
                <div class="contact-form-slim-item" style="height: 42px; margin-top: 0px;">
                    <input id="btnSendEnquiry" type="submit" value="Send" class="contact-form-slim-button float-right" />
                </div>
                }
            }
        </div>
    </div>
    

    I've created a macro with the "editor settings" checked.

    Then, in the grid editor I add a rich text editor and some html code and I insert the macro in it.

    In edit mode a see the macro ok but if I publish the web, I get a "Macro alias: macroAliasName" message (I solved this adding an extra space after the macro ¬ ¬) or I only see the labels but not the input fields

    I don't know if I'm missing something or if there is a better way to do this.

    Hope someone can help.

    Thanks a lot

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 08, 2016 @ 15:18
    Sebastiaan Janssen
    0

    Unfortunately this is still an open bug, we recommend using and RTE cell and under that a macro picker cell for now:

    http://issues.umbraco.org/issue/U4-6206

  • 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