Copied to clipboard

Flag this post as spam?

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


  • Henry 4 posts 24 karma points
    Dec 28, 2013 @ 08:58
    Henry
    0

    Macro two submit buttons on Save and Publish

    Hello,

    I'm not sure what I may have done wrong here, but I'm getting two Submit buttons when adding a form via a macro to rich text box. This happens when I click "Save" or "Save and Publish".

    The code generated after Save is as follows:

    <div class="umb-macro-holder CommentForm mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="CommentForm" /> --> <ins>
    <div class="form-group"></div>
    <div class="form-group"></div>
    <div class="form-group"></div>
    <button class="btn btn-default">Submit</button> </ins></div>
    <div class="form-group"></div>
    <div class="form-group"></div>
    <p><button class="btn btn-default">Submit</button></p>

    The code in my Comment Form is as follows:

    @model UmbracoSurfaceControllers.Models.CommentFormViewModel

    @if (TempData["success"] == null)
    {
        using (Html.BeginUmbracoForm("HandleFormSubmit", "CommentsFormSurface"))
        {
            <div class="form-group">
                @Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "Name" })
                @Html.ValidationMessageFor(m => m.Name)
            </div>
            <div class="form-group">
                @Html.TextBoxFor(m => m.Email, new { @class = "form-control", placeholder = "Email address" })
                @Html.ValidationMessageFor(m => m.Email)
            </div>
            <div class="form-group">
                @Html.TextAreaFor(m => m.Comment, new { @class = "form-control", placeholder = "Your comment" })
                @Html.ValidationMessageFor(m => m.Comment)
            </div>

            <button id="comment-submit" type="submit" class="btn btn-default">Submit</button>
        }
    }
    else
    {
        <p>Thank you</p>
    }

    In my Comment Form macro I have code as follows:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @Html.Action("Index", "CommentsFormSurface")

    Any ideas why this might be happening?

    Much appreciated,

    Henry

  • Alex Skrypnyk 6159 posts 24129 karma points MVP 8x admin c-trib
    Dec 30, 2013 @ 12:32
    Alex Skrypnyk
    0

    Hi Henry,

    Did you try to remove second submit button from generated code ?

    I can suppose that one of buttons is default and not needed on your form.

    THanks,

    Alex

  • Henry 4 posts 24 karma points
    Dec 30, 2013 @ 14:45
    Henry
    0

    Hi Alex,

    Yes - tried manually removing the additional code; however on re-publishing, the additional button re-appears.

    I re-placed the <button> with an <input> control, and it isn't doing it any more. So all is good.

    Cheers,

    Henry

Please Sign in or register to post replies

Write your reply to:

Draft